more assertions for indirect errors

This commit is contained in:
Kagami Sascha Rosylight 2023-06-13 22:55:23 +02:00
parent c83628e5d0
commit 95dd66a0ba
1 changed files with 7 additions and 5 deletions

View File

@ -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<void> {
@ -840,6 +844,4 @@ describe('OAuth', () => {
});
// TODO: Add spec links to tests
// TODO: Check whether indirect errors have state and iss
});