From 95dd66a0bac6a322874234bac5ab6b2ced921450 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 13 Jun 2023 22:55:23 +0200 Subject: [PATCH] more assertions for indirect errors --- packages/backend/test/e2e/oauth.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/backend/test/e2e/oauth.ts b/packages/backend/test/e2e/oauth.ts index 3f75569a8..fe52f6888 100644 --- a/packages/backend/test/e2e/oauth.ts +++ b/packages/backend/test/e2e/oauth.ts @@ -116,9 +116,13 @@ async function fetchAuthorizationCode(user: misskey.entities.MeSignup, scope: st function assertIndirectError(response: Response, error: string): void { assert.strictEqual(response.status, 302); - const location = response.headers.get('location'); - assert.ok(location); - assert.strictEqual(new URL(location).searchParams.get('error'), error); + const locationHeader = response.headers.get('location'); + assert.ok(locationHeader); + + const location = new URL(locationHeader); + assert.strictEqual(location.searchParams.get('error'), error); + assert.strictEqual(location.searchParams.get('iss'), 'http://misskey.local'); + assert.ok(location.searchParams.has('state')); } async function assertDirectError(response: Response, status: number, error: string): Promise { @@ -840,6 +844,4 @@ describe('OAuth', () => { }); // TODO: Add spec links to tests - - // TODO: Check whether indirect errors have state and iss });