mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
Added basic e2e test for Members API .well-known endpoint
refs https://github.com/TryGhost/Team/issues/1640 refs https://github.com/TryGhost/Members/pull/401 - Adds basic test coverage for the `GET /members/.well-known/jwks.json` endpoint - Next the test should be expanded with the JWT verification to check if the returned format is usable by mainstream client libraries
This commit is contained in:
parent
c001865e7c
commit
72479a152f
2 changed files with 55 additions and 0 deletions
27
test/e2e-api/members/__snapshots__/well-known.test.js.snap
Normal file
27
test/e2e-api/members/__snapshots__/well-known.test.js.snap
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Members .well-known GET /jwks.json should return a JWKS 1: [body] 1`] = `
|
||||
Object {
|
||||
"keys": Array [
|
||||
Object {
|
||||
"e": "AQAB",
|
||||
"kid": Any<String>,
|
||||
"kty": "RSA",
|
||||
"n": Any<String>,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Members .well-known GET /jwks.json should return a JWKS 2: [headers] 1`] = `
|
||||
Object {
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "public, max-age=86400",
|
||||
"content-length": "265",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
28
test/e2e-api/members/well-known.test.js
Normal file
28
test/e2e-api/members/well-known.test.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const {agentProvider, fixtureManager, matchers} = require('../../utils/e2e-framework');
|
||||
const {anyString, anyEtag} = matchers;
|
||||
|
||||
describe('Members .well-known', function () {
|
||||
let membersAgent;
|
||||
|
||||
before(async function () {
|
||||
const agents = await agentProvider.getAgentsForMembers();
|
||||
membersAgent = agents.membersAgent;
|
||||
});
|
||||
|
||||
describe('GET /jwks.json', function () {
|
||||
it('should return a JWKS', async function () {
|
||||
await membersAgent
|
||||
.get('/.well-known/jwks.json')
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot({
|
||||
keys: [{
|
||||
kid: anyString,
|
||||
n: anyString
|
||||
}]
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: anyEtag
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue