Covered well-known endpoint with e2e test

refs https://github.com/TryGhost/Team/issues/1640

- There was no coverage. Now there is :)
This commit is contained in:
Naz 2022-05-20 13:18:26 +08:00
parent a18469a3be
commit fd8ce6a5bf
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`.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[`.well-known GET /jwks.json should return a JWKS 2: [headers] 1`] = `
Object {
"content-length": "265",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Accept-Encoding",
"x-powered-by": "Express",
}
`;

View File

@ -0,0 +1,27 @@
const {agentProvider, matchers} = require('../utils/e2e-framework');
const {anyString, anyEtag} = matchers;
describe('.well-known', function () {
let agentGhostAPI;
before(async function () {
agentGhostAPI = await agentProvider.getGhostAPIAgent();
});
describe('GET /jwks.json', function () {
it('should return a JWKS', async function () {
await agentGhostAPI
.get('/.well-known/jwks.json')
.expectStatus(200)
.matchBodySnapshot({
keys: [{
kid: anyString,
n: anyString
}]
})
.matchHeaderSnapshot({
etag: anyEtag
});
});
});
});