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:
@ -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]
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import {
|
||||
ActivityType,
|
||||
Comment,
|
||||
CommentableType,
|
||||
CommentThread,
|
||||
@ -11,6 +12,7 @@ type MockedCommentThread = Pick<
|
||||
| 'createdAt'
|
||||
| 'updatedAt'
|
||||
| '__typename'
|
||||
| 'type'
|
||||
| 'body'
|
||||
| 'title'
|
||||
| 'authorId'
|
||||
@ -42,6 +44,7 @@ export const mockedCommentThreads: Array<MockedCommentThread> = [
|
||||
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
title: 'My very first note',
|
||||
type: ActivityType.Note,
|
||||
body: null,
|
||||
author: {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
@ -88,6 +91,7 @@ export const mockedCommentThreads: Array<MockedCommentThread> = [
|
||||
updatedAt: new Date().toISOString(),
|
||||
title: 'Another note',
|
||||
body: null,
|
||||
type: ActivityType.Note,
|
||||
author: {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
firstName: 'Charles',
|
||||
|
||||
@ -37,6 +37,7 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
displayName: 'Charles Test',
|
||||
firstName: 'Charles',
|
||||
lastName: 'Test',
|
||||
avatarUrl: null,
|
||||
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
|
||||
__typename: 'User',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user