Skip to content

Commit

Permalink
Verify response is either 200 or 202 (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcatanese authored Mar 6, 2024
1 parent db8e4f7 commit 6af9892
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/subscription/display-token.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,23 @@ test('Display RecurringDetailReference', async ({ request, page }) => {
});

// Verify status code
expect(notifications.status()).toEqual(200);
var notifications_status = notifications.status();

if (notifications_status === 202) {
// Verify status code 202
expect(notifications.status()).toEqual(202);

// Verify empty response body
notifications.text()
.then(value => { expect(value).toEqual(""); });
} else {
// Verify legacy webhook acknowledgment (status code 200)
expect(notifications.status()).toEqual(200);

// Verify legacy webhook acknowledgment (response body `[accepted]`)
notifications.text()
.then(value => { expect(value).toEqual("[accepted]"); });
}

// Verify token is visible in the Admin panel
await page.goto('/admin');
Expand Down

0 comments on commit 6af9892

Please sign in to comment.