Skip to content

Commit

Permalink
increased code coverage to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
KrutikaBhatt committed Mar 2, 2023
1 parent ca6ba21 commit 5681888
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/resolvers/Subscription/messageSentToGroupChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const messageSentToGroupChat: SubscriptionResolvers["messageSentToGroupCh
// @ts-ignore
subscribe: withFilter(
(_parent, _args, context) =>
context?.pubsub.asyncIterator([MESSAGE_SENT_TO_GROUP_CHAT]),
context.pubsub.asyncIterator([MESSAGE_SENT_TO_GROUP_CHAT]),

async (payload, _variables, context) => filterFunction(payload, context)
),
};
6 changes: 3 additions & 3 deletions tests/resolvers/Subscription/messageSentToGroupChat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("src -> resolvers -> Subscription -> messageSentToGroupChat", () => {
const _parent = {};
const context = {
pubsub: {
asyncInterator: (_action: "MESSAGE_SENT_TO_GROUP_CHAT") => {
asyncIterator: (_action: "MESSAGE_SENT_TO_GROUP_CHAT") => {
return;
},
},
Expand All @@ -50,8 +50,8 @@ describe("src -> resolvers -> Subscription -> messageSentToGroupChat", () => {
// @ts-ignore
messageSentToGroupChatPayload.payload = payload;
// @ts-ignore
const x = messageSentToGroupChatPayload?.subscribe;
expect(x()).not.toBe(null);
const x = messageSentToGroupChatPayload?.subscribe(_parent, _args, context);
expect(x).not.toBe(null);
expect(await filterFunction(payload, context)).toBe(true);
});
});

0 comments on commit 5681888

Please sign in to comment.