Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Dec 5, 2024
1 parent c6460e5 commit 8610f1c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/store/__test__/main.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { toJS } from 'mobx';
import sinon from 'sinon';
import moment from 'moment';
import { waitFor } from '@testing-library/react';
import { people } from '../../__test__/__mockData__/persons';
import { user } from '../../__test__/__mockData__/user';
import { MeInfo, emptyMeInfo, uiStore } from '../ui';
Expand Down Expand Up @@ -1146,6 +1147,7 @@ describe('Main store', () => {
);
expect(res).toBeTruthy();
});

it('should accept search query and return results based on query ', async () => {
const store = new MainStore();

Expand Down Expand Up @@ -1178,10 +1180,12 @@ describe('Main store', () => {

await store.getPeopleBounties(searchCriteria);

sinon.assert.calledWithMatch(fetchStub, bountiesUrl);
expect(fetchStub.calledOnce).toBe(true);
expect(store.peopleBounties).toHaveLength(1);
expect(store.peopleBounties[0].body.title).toEqual(searchCriteria.search);
waitFor(() => {
sinon.assert.calledWithMatch(fetchStub, bountiesUrl);
expect(fetchStub.calledOnce).toBe(true);
expect(store.peopleBounties).toHaveLength(1);
expect(store.peopleBounties[0].body.title).toEqual(searchCriteria.search);
});
});

it('should return filter by languages, status response', async () => {
Expand Down

0 comments on commit 8610f1c

Please sign in to comment.