Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('verifyTruepicWebhook', () => {
})

describe('timestamp leeway window', () => {
it('accepts a timestamp exactly at the future leeway window', (t) => {
it('accepts a webhook that arrives exactly 5 minutes late', (t) => {
t.mock.timers.enable({
apis: ['Date'],
now: sentAtMs + 1000 * 60 * 5,
Expand All @@ -50,7 +50,7 @@ describe('verifyTruepicWebhook', () => {
)
})

it('accepts a timestamp exactly at the past leeway window', (t) => {
it('accepts a webhook whose sender clock is exactly 5 minutes ahead', (t) => {
t.mock.timers.enable({
apis: ['Date'],
now: sentAtMs - 1000 * 60 * 5,
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('verifyTruepicWebhook', () => {
)
})

it('if the timestamp is outside the future leeway window', (t) => {
it('if the webhook arrives more than 5 minutes late', (t) => {
t.mock.timers.enable({
apis: ['Date'],
now: sentAtMs + 1000 * 60 * 5 + 1,
Expand All @@ -221,7 +221,7 @@ describe('verifyTruepicWebhook', () => {
)
})

it('if the timestamp is outside the past leeway window', (t) => {
it('if the sender clock is more than 5 minutes ahead', (t) => {
t.mock.timers.enable({
apis: ['Date'],
now: sentAtMs - 1000 * 60 * 5 - 1,
Expand Down