Skip to content

Commit

Permalink
Add missing payload guard
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Jun 1, 2021
1 parent 7ac9d4c commit 553aa8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/nextjs/test/integration/test/utils.js
Expand Up @@ -115,15 +115,18 @@ module.exports.sleep = duration => {
};

module.exports.expectEvent = (request, expectedEvent) => {
if (!request) throw new Error('Event missing');
return assertObjectMatches(extractEventFromRequest(request), expectedEvent);
};

module.exports.expectSession = (request, expectedItem) => {
if (!request) throw new Error('Session missing');
const { itemHeader, item } = extractEnvelopeFromRequest(request);
return itemHeader.type === 'session' && assertObjectMatches(item, expectedItem);
};

module.exports.expectTransaction = (request, expectedItem) => {
if (!request) throw new Error('Transaction missing');
const { itemHeader, item } = extractEnvelopeFromRequest(request);
return itemHeader.type === 'transaction' && assertObjectMatches(item, expectedItem);
};
Expand Down

0 comments on commit 553aa8b

Please sign in to comment.