Skip to content

Commit

Permalink
Fix tests (#7722)
Browse files Browse the repository at this point in the history
As per title ;)
  • Loading branch information
charlesBochet authored Oct 16, 2024
1 parent 0a5bc02 commit 4d0af3e
Showing 1 changed file with 39 additions and 15 deletions.
54 changes: 39 additions & 15 deletions packages/twenty-front/src/testing/graphqlMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,47 @@ export const graphqlMocks = {
});
},
),
graphql.query('FindManyViews', ({ variables }) => {
const objectMetadataId = variables.filter?.objectMetadataId?.eq;
const viewType = variables.filter?.type?.eq;

graphql.query('SearchPeople', () => {
return HttpResponse.json({
data: {
views: {
edges: mockedViewsData
.filter(
(view) =>
view?.objectMetadataId === objectMetadataId &&
view?.type === viewType,
)
.map((view) => ({
node: view,
cursor: null,
})),
searchPeople: {
edges: peopleMock.slice(0, 3).map((person) => ({
node: person,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
},
});
}),
graphql.query('SearchCompanies', () => {
return HttpResponse.json({
data: {
searchCompanies: {
edges: companiesMock.slice(0, 3).map((company) => ({
node: company,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
},
});
}),
graphql.query('SearchOpportunities', () => {
return HttpResponse.json({
data: {
searchOpportunities: {
edges: [],
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
Expand Down

0 comments on commit 4d0af3e

Please sign in to comment.