Skip to content

Commit

Permalink
Fix storybook tests
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Oct 30, 2024
1 parent 692c4ba commit 3957658
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
27 changes: 27 additions & 0 deletions packages/twenty-front/src/testing/graphqlMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,33 @@ export const graphqlMocks = {
},
});
}),
graphql.query('FindManyViews', ({ variables }) => {
const objectMetadataId = variables.filter?.objectMetadataId?.eq;
const viewType = variables.filter?.type?.eq;

return HttpResponse.json({
data: {
views: {
edges: mockedViewsData
.filter(
(view) =>
view?.objectMetadataId === objectMetadataId &&
view?.type === viewType,
)
.map((view) => ({
node: view,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
},
});
}),
graphql.query('SearchWorkspaceMembers', () => {
return HttpResponse.json({
data: {
Expand Down
9 changes: 8 additions & 1 deletion packages/twenty-front/src/testing/mock-data/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const mockedViewsData = [
createdAt: '2021-09-01T00:00:00.000Z',
updatedAt: '2021-09-01T00:00:00.000Z',
isCompact: false,

viewFilterGroups: [],
viewGroups: [],
__typename: 'View',
},
{
Expand All @@ -40,6 +41,8 @@ export const mockedViewsData = [
createdAt: '2021-09-01T00:00:00.000Z',
updatedAt: '2021-09-01T00:00:00.000Z',
isCompact: false,
viewFilterGroups: [],
viewGroups: [],
__typename: 'View',
},
{
Expand All @@ -54,6 +57,8 @@ export const mockedViewsData = [
createdAt: '2021-09-01T00:00:00.000Z',
updatedAt: '2021-09-01T00:00:00.000Z',
isCompact: false,
viewFilterGroups: [],
viewGroups: [],
__typename: 'View',
},
{
Expand All @@ -68,6 +73,8 @@ export const mockedViewsData = [
createdAt: '2021-09-01T00:00:00.000Z',
updatedAt: '2021-09-01T00:00:00.000Z',
isCompact: false,
viewFilterGroups: [],
viewGroups: [],
__typename: 'View',
},
];

0 comments on commit 3957658

Please sign in to comment.