Skip to content

Commit 9cc603d

Browse files
committed
Updating unit tests to match with hotfixes
1 parent b76a9e7 commit 9cc603d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

test/components/Modals/NewMessageModal.test.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ it('selecting contact from autocomplete', async () => {
113113
{
114114
familyName: 'test',
115115
givenName: 'mock',
116-
person: 'mock test',
117116
podUrl: 'http://example/mocktest',
118117
thingId: 'http://example/mocktest/profile/card#me',
119118
webId: 'http://example/mocktest/profile/card#me'
@@ -135,5 +134,5 @@ it('selecting contact from autocomplete', async () => {
135134
// Enter to select dropdown option
136135
await userEvent.keyboard('[Enter]');
137136
// verify value of input field
138-
expect(toInput.value).toBe('mock test');
137+
expect(toInput.value).toBe('http://example/mocktest');
139138
});

test/pages/Contacts.test.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('Contacts Page', () => {
2323
});
2424

2525
it('displays Loading message while loading', () => {
26-
useContactsList.mockReturnValue({ isLoading: true });
26+
useContactsList.mockReturnValue({ isLoading: true, refetch: vi.fn() });
2727
const { getByRole } = render(
2828
<QueryClientProvider client={queryClient}>
2929
<Contacts />
@@ -35,7 +35,11 @@ describe('Contacts Page', () => {
3535

3636
it('displays Errors when fetch errors', () => {
3737
const errorMessage = 'error';
38-
useContactsList.mockReturnValue({ isError: true, error: { message: errorMessage } });
38+
useContactsList.mockReturnValue({
39+
isError: true,
40+
error: { message: errorMessage },
41+
refetch: vi.fn()
42+
});
3943
const { getByText } = render(
4044
<QueryClientProvider client={queryClient}>
4145
<Contacts />
@@ -58,7 +62,7 @@ describe('Contacts Page', () => {
5862
givenName: 'Batman',
5963
webId: 'http://batman.com'
6064
};
61-
useContactsList.mockReturnValue({ data: [firstContact, secondContact] });
65+
useContactsList.mockReturnValue({ data: [firstContact, secondContact], refetch: vi.fn() });
6266
const { getByRole } = render(
6367
<QueryClientProvider client={queryClient}>
6468
<BrowserRouter>
@@ -70,7 +74,7 @@ describe('Contacts Page', () => {
7074
expect(contacts).not.toBeNull();
7175
});
7276
it('displays empty list message when there are no contacts', () => {
73-
useContactsList.mockReturnValue({ data: [] });
77+
useContactsList.mockReturnValue({ data: [], refetch: vi.fn() });
7478
const { getByLabelText } = render(
7579
<QueryClientProvider client={queryClient}>
7680
<Contacts />

0 commit comments

Comments
 (0)