Improve test coverage and refactor storybook arch (#723)

* Improve test coverage and refactor storybook arch

* Fix coverage

* Fix tests

* Fix lint

* Fix lint
This commit is contained in:
Charles Bochet
2023-07-17 17:14:53 -07:00
committed by GitHub
parent 5b21657c4e
commit a972705ce6
43 changed files with 365 additions and 274 deletions

View File

@ -8,6 +8,7 @@ import { GET_PEOPLE, UPDATE_PERSON } from '@/people/queries';
import { GET_PIPELINE_PROGRESS, GET_PIPELINES } from '@/pipeline/queries';
import {
SEARCH_COMPANY_QUERY,
SEARCH_PEOPLE_QUERY,
SEARCH_USER_QUERY,
} from '@/search/queries/search';
import { GET_CURRENT_USER } from '@/users/queries';
@ -15,6 +16,7 @@ import {
GetCompaniesQuery,
GetPeopleQuery,
SearchCompanyQuery,
SearchPeopleQuery,
SearchUserQuery,
} from '~/generated/graphql';
@ -61,6 +63,26 @@ export const graphqlMocks = [
);
},
),
graphql.query(
getOperationName(SEARCH_PEOPLE_QUERY) ?? '',
(req, res, ctx) => {
const returnedMockedData = filterAndSortData<
SearchPeopleQuery['searchResults'][0]
>(
mockedPeopleData,
req.variables.where,
Array.isArray(req.variables.orderBy)
? req.variables.orderBy
: [req.variables.orderBy],
req.variables.limit,
);
return res(
ctx.data({
searchResults: returnedMockedData,
}),
);
},
),
graphql.query(getOperationName(SEARCH_USER_QUERY) ?? '', (req, res, ctx) => {
const returnedMockedData = filterAndSortData<
SearchUserQuery['searchResults'][0]