Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrancis committed Aug 6, 2024
1 parent d3b8aec commit 917eb28
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/integration/oauth-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,27 @@ describe('oauth/', function () {
customCallbackHandler = customCallbackHandlerProvided || null;
}

it('serves OAuth metadata', async () => {
const res = await chai
.request(server)
.keepOpen()
.get('/.well-known/oauth-authorization-server')
.set('Accept', 'application/json');
expect(res.status).toEqual(200);
expect(res.body).toHaveProperty('issuer');
expect(res.body).toHaveProperty('authorization_endpoint');
expect(res.body.authorization_endpoint).toEqual(expect.stringContaining('authorize'));
expect(res.body).toHaveProperty('token_endpoint');
expect(res.body.token_endpoint).toEqual(expect.stringContaining('token'));
expect(res.body).toHaveProperty('response_types_supported');
expect(res.body.response_types_supported.length).toEqual(1);
expect(res.body.response_types_supported[0]).toEqual('code');
expect(res.body).toHaveProperty('scopes_supported');
expect(res.body.scopes_supported.length).toEqual(2);
expect(res.body.scopes_supported).toContain('/things');
expect(res.body.scopes_supported).toContain('/things:readwrite');
});

it('performs simple authorization', async () => {
setupOAuth();

Expand Down

0 comments on commit 917eb28

Please sign in to comment.