Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests in fhir-group-management
Browse files Browse the repository at this point in the history
Fixes issue that happens on windows.
peterMuriuki committed Jan 21, 2025
1 parent 87862c7 commit 7cfb729
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -284,11 +284,14 @@ it('can create new commodity', async () => {

fireEvent.click(screen.getByRole('button', { name: /Save/i }));

await waitFor(() => {
expect(nock.pendingMocks()).toEqual([]);
});

await waitFor(() => {
expect(errorNoticeMock).not.toHaveBeenCalled();
expect(successNoticeMock.mock.calls).toEqual([['Commodity updated successfully']]);
});

expect(nock.isDone()).toBeTruthy();
});

@@ -402,12 +405,15 @@ it('edits resource', async () => {

userEvent.click(screen.getByRole('button', { name: /Save/i }));

await waitFor(() => {
expect(nock.pendingMocks()).toEqual([]);
});

await waitFor(() => {
expect(successNoticeMock.mock.calls).toEqual([['Commodity updated successfully']]);
expect(errorNoticeMock.mock.calls).toEqual([]);
});

expect(nock.pendingMocks()).toEqual([]);
expect(nock.isDone()).toBeTruthy();
});

@@ -479,12 +485,14 @@ it('can remove product image', async () => {
expect(successNoticeMock.mock.calls).toEqual([['Commodity updated successfully']]);
});

await waitFor(() => {
expect(nock.pendingMocks()).toEqual([]);
});

await waitFor(() => {
expect(errorNoticeMock.mock.calls).toEqual([]);
expect(successNoticeMock.mock.calls).toEqual([['Commodity updated successfully']]);
});

expect(nock.pendingMocks()).toEqual([]);
});

test('cancel handler is called on cancel', async () => {
@@ -503,6 +511,7 @@ test('cancel handler is called on cancel', async () => {

fireEvent.click(cancelBtn);
expect(history.location.pathname).toEqual('/commodity/list');
expect(nock.pendingMocks()).toEqual([]);
});

test('data loading problem', async () => {
@@ -523,4 +532,5 @@ test('data loading problem', async () => {

// errors out
expect(screen.getByText(/something aweful happened/)).toBeInTheDocument();
expect(nock.pendingMocks()).toEqual([]);
});

0 comments on commit 7cfb729

Please sign in to comment.