Skip to content

Commit

Permalink
Fix some race conditions and error conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed Sep 12, 2024
1 parent 94b1908 commit f29b068
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions test/authorization-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const codeChallenge = 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM';
describe('authorization-code', () => {
let server: ReturnType<typeof testServer>;

after(() => {
after(async () => {
if (server) {
server.close();
await server.close();
}
});

Expand Down
4 changes: 2 additions & 2 deletions test/client-credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { after, describe, it } from 'node:test';
describe('client-credentials', () => {
let server: ReturnType<typeof testServer>;

after(() => {
after(async () => {
if (server) {
server.close();
await server.close();
}

});
Expand Down
4 changes: 2 additions & 2 deletions test/password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { after, describe, it } from 'node:test';
describe('password', () => {
let server: ReturnType<typeof testServer>;

after(() => {
after(async () => {
if (server) {
server.close();
await server.close();
}
});

Expand Down
4 changes: 2 additions & 2 deletions test/revoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { after, describe, it } from 'node:test';
describe('Token revocation', () => {
const server = testServer();

after(() => {
after(async () => {
if (server) {
server.close();
await server.close();
}
});

Expand Down
6 changes: 3 additions & 3 deletions test/test-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function testServer() {

const oauth2Error: Middleware = (ctx, next) => {

if (ctx.request.body.client_id !== 'oauth2-error') {
if (ctx.request.body?.client_id !== 'oauth2-error') {
return next();
}

Expand All @@ -72,7 +72,7 @@ const oauth2Error: Middleware = (ctx, next) => {
};
const jsonError: Middleware = (ctx, next) => {

if (ctx.request.body.client_id !== 'json-error') {
if (ctx.request.body?.client_id !== 'json-error') {
return next();
}

Expand All @@ -88,7 +88,7 @@ const jsonError: Middleware = (ctx, next) => {
};
const generalHttpError: Middleware = (ctx, next) => {

if (ctx.request.body.client_id !== 'general-http-error') {
if (ctx.request.body?.client_id !== 'general-http-error') {
return next();
}

Expand Down

0 comments on commit f29b068

Please sign in to comment.