0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Updated test suites to play nicely with 5.0

refs https://github.com/TryGhost/Toolbox/issues/335

- When eventually the major will be bumped next week the returned version will become `5.0.0` which changes the `content-length` header in all of the responses using the version from package.json
- The version number is dynamic, so it's expected the content-length to float as minor and patch versions fluctuate in 1-2 digit numbers. For lon-term easy maintenance it's best to set the content-length to any number (or maybe some sort of floating range in the future?)
This commit is contained in:
Naz 2022-05-19 13:50:44 +08:00
parent d2e9a98846
commit c3d38a9144
6 changed files with 15 additions and 11 deletions

View file

@ -18,7 +18,7 @@ exports[`Site API can retrieve config and all expected properties 2: [headers] 1
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "167",
"content-length": StringMatching /\\\\d\\+/,
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",

View file

@ -25,7 +25,7 @@ exports[`Webhooks API Can create a webhook 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "392",
"content-length": StringMatching /\\\\d\\+/,
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
@ -68,7 +68,7 @@ exports[`Webhooks API Can edit a webhook 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "396",
"content-length": StringMatching /\\\\d\\+/,
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",

View file

@ -1,5 +1,5 @@
const {agentProvider, matchers} = require('../../utils/e2e-framework');
const {anyEtag, stringMatching} = matchers;
const {anyEtag, stringMatching, anyContentLength} = matchers;
describe('Site API', function () {
let agent;
@ -17,7 +17,8 @@ describe('Site API', function () {
}
})
.matchHeaderSnapshot({
etag: anyEtag
etag: anyEtag,
'content-length': anyContentLength
});
});
});

View file

@ -1,5 +1,5 @@
const {agentProvider, fixtureManager, matchers} = require('../../utils/e2e-framework');
const {anyEtag, anyErrorId, anyObjectId, anyISODate, stringMatching} = matchers;
const {anyEtag, anyErrorId, anyObjectId, anyISODate, stringMatching, anyContentLength} = matchers;
const webhookMatcher = {
id: anyObjectId,
@ -35,7 +35,8 @@ describe('Webhooks API', function () {
.expectStatus(201)
.matchHeaderSnapshot({
// Note: No location header as there is no read method for webhooks
etag: anyEtag
etag: anyEtag,
'content-length': anyContentLength
})
.matchBodySnapshot({
@ -93,7 +94,8 @@ describe('Webhooks API', function () {
})
.expectStatus(200)
.matchHeaderSnapshot({
etag: anyEtag
etag: anyEtag,
'content-length': anyContentLength
})
.matchBodySnapshot({
webhooks: [webhookMatcher]

View file

@ -96,7 +96,7 @@ exports[`Settings Content API Can request settings 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "*",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "1235",
"content-length": StringMatching /\\\\d\\+/,
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Accept-Encoding",

View file

@ -1,5 +1,5 @@
const {agentProvider, fixtureManager, matchers} = require('../../utils/e2e-framework');
const {anyEtag} = matchers;
const {anyEtag, anyContentLength} = matchers;
const settingsMatcher = {
version: matchers.anyString
@ -18,7 +18,8 @@ describe('Settings Content API', function () {
await agent.get('settings/')
.expectStatus(200)
.matchHeaderSnapshot({
etag: anyEtag
etag: anyEtag,
'content-length': anyContentLength
})
.matchBodySnapshot({
settings: settingsMatcher