Fix tests

This commit is contained in:
Charles Bochet
2023-08-25 22:04:05 +02:00
parent f5594626ff
commit f8e3dd3f6b
4 changed files with 28 additions and 4 deletions

View File

@ -179,8 +179,8 @@
"workerDirectory": "public"
},
"nyc": {
"statements": 65,
"lines": 65,
"statements": 60,
"lines": 60,
"functions": 60,
"exclude": [
"src/generated/**/*"

View File

@ -77,11 +77,12 @@ export function CompanyPickerCell({
});
setIsCreating(false);
}
const noUser: EntityForSelect = {
const noCompany: CompanyPickerSelectedCompany = {
entityType: Entity.Company,
id: '',
name: 'No Company',
avatarType: 'rounded',
domainName: '',
avatarUrl: '',
};
return isCreating ? (
@ -103,7 +104,7 @@ export function CompanyPickerCell({
selectedEntity: companies.selectedEntities[0],
loading: companies.loading,
}}
noUser={noUser}
noUser={noCompany}
/>
);
}

View File

@ -17,6 +17,7 @@ import { SEARCH_PEOPLE_QUERY } from '@/search/graphql/queries/searchPeopleQuery'
import { SEARCH_USER_QUERY } from '@/search/graphql/queries/searchUserQuery';
import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';
import { GET_VIEW_FIELDS } from '@/views/graphql/queries/getViewFields';
import { GET_VIEWS } from '@/views/graphql/queries/getViews';
import {
GetCompaniesQuery,
GetPeopleQuery,
@ -36,6 +37,7 @@ import { mockedPeopleData, mockedPersonViewFields } from './mock-data/people';
import { mockedPipelineProgressData } from './mock-data/pipeline-progress';
import { mockedPipelinesData } from './mock-data/pipelines';
import { mockedUsersData } from './mock-data/users';
import { mockedViews } from './mock-data/views';
import {
fetchOneFromData,
filterAndSortData,
@ -250,4 +252,11 @@ export const graphqlMocks = [
);
},
),
graphql.query(getOperationName(GET_VIEWS) ?? '', (req, res, ctx) => {
return res(
ctx.data({
views: mockedViews,
}),
);
}),
];

View File

@ -0,0 +1,14 @@
import { View } from '~/generated/graphql';
type MockedView = Pick<View, 'id' | 'name'>;
export const mockedViews: Array<MockedView> = [
{
id: '89bb825c-171e-4bcc-9cf7-43448d6fb230a',
name: 'All',
},
{
id: '89bb825c-171e-4bcc-9cf7-43448d6fb230a',
name: 'View example 1',
},
];