Skip to content

Commit

Permalink
add mock for new getSearchAutocompleteDialogs query
Browse files Browse the repository at this point in the history
  • Loading branch information
mbacherycz committed Dec 16, 2024
1 parent 4fabc15 commit 9c3f7b1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/frontend/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ const mutateUpdateSystemLabelMock = graphql.mutation('updateSystemLabel', (req)
});
});

const searchAutocompleteDialogsMock = graphql.query('getSearchAutocompleteDialogs', (req) => {
const {
variables: { partyURIs, search },
} = req;
const itemsForParty = inMemoryStore.dialogs.filter((dialog) => partyURIs.includes(dialog.party));

return HttpResponse.json({
data: {
searchDialogs: {
items: itemsForParty.filter((item) => naiveSearchFilter(item, search)),
},
},
});
})

export const handlers = [
isAuthenticatedMock,
getAllDialogsForPartiesMock,
Expand All @@ -188,4 +203,5 @@ export const handlers = [
mutateUpdateSystemLabelMock,
deleteSavedSearchMock,
getOrganizationsMock,
searchAutocompleteDialogsMock
];

0 comments on commit 9c3f7b1

Please sign in to comment.