Skip to content

Commit

Permalink
fix: request validation test fix (#1141)
Browse files Browse the repository at this point in the history
Fix the test conditions and the payload to be proper.
  • Loading branch information
childish-sambino authored Jun 10, 2020
1 parent f095129 commit 38d43a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test:
yarn test:files
yarn test:license
yarn test:typescript
yarn test:eventwebhook

test-integ: test
yarn test:mail
Expand Down
12 changes: 6 additions & 6 deletions packages/eventwebhook/src/eventwebhook.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ describe('EventWebhook', () => {
const SIGNATURE = 'MEUCIQCtIHJeH93Y+qpYeWrySphQgpNGNr/U+UyUlBkU6n7RAwIgJTz2C+8a8xonZGi6BpSzoQsbVRamr2nlxFDWYNH2j/0=';
const TIMESTAMP = '1588788367';
const PAYLOAD = {
event: 'test_event',
category: 'example_payload',
event: 'test_event',
message_id: 'message_id',
};

Expand All @@ -17,7 +17,7 @@ describe('EventWebhook', () => {
PAYLOAD,
SIGNATURE,
TIMESTAMP
)).to.be.true;
)).to.equal(true);
});

it('should reject for invalid key', () => {
Expand All @@ -26,7 +26,7 @@ describe('EventWebhook', () => {
PAYLOAD,
SIGNATURE,
TIMESTAMP
)).to.be.false;
)).to.equal(false);
});

it('should reject for bad payload', () => {
Expand All @@ -35,7 +35,7 @@ describe('EventWebhook', () => {
'payload',
SIGNATURE,
TIMESTAMP
)).to.be.false;
)).to.equal(false);
});

it('should reject for bad signature', () => {
Expand All @@ -44,7 +44,7 @@ describe('EventWebhook', () => {
PAYLOAD,
'MEUCIQCtIHJeH93Y+qpYeWrySphQgpNGNr/U+UyUlBkU6n7RAwIgJTz2C+8a8xonZGi6BpSzoQsbVRamr2nlxFDWYNH3j/0=',
TIMESTAMP
)).to.be.false;
)).to.equal(false);
});

it('should reject for bad timestamp', () => {
Expand All @@ -53,7 +53,7 @@ describe('EventWebhook', () => {
PAYLOAD,
SIGNATURE,
'timestamp'
)).to.be.false;
)).to.equal(false);
});
});
});
Expand Down

0 comments on commit 38d43a1

Please sign in to comment.