From 1fadbacdecb5fa995bf16b0a8ca3094060cfd8bf Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Fri, 19 Aug 2022 10:51:43 +0100 Subject: [PATCH] Fixed content-length in labs snapshot refs: https://github.com/TryGhost/Ghost/commit/22fd7f289c75447985ee2e8a4b497e9c1afbad07 - in the mentioned commit I changed the tests so that we don't need to update snapshots for every labs flag change - this commit does the same for content-length which didn't get picked up locally, but does on CI for some reason - the goal is to allow the team to add and remove flags without needing to update a random snapshot --- .../test/e2e-api/admin/__snapshots__/settings.test.js.snap | 2 +- ghost/core/test/e2e-api/admin/settings.test.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap index fe57854af3..d2e3a632f9 100644 --- a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap +++ b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap @@ -280,7 +280,7 @@ exports[`Settings API Browse Can request all settings 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": "3452", + "content-length": StringMatching /\\\\d\\+/, "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", diff --git a/ghost/core/test/e2e-api/admin/settings.test.js b/ghost/core/test/e2e-api/admin/settings.test.js index 08d43f3bfa..d4705e12a8 100644 --- a/ghost/core/test/e2e-api/admin/settings.test.js +++ b/ghost/core/test/e2e-api/admin/settings.test.js @@ -3,7 +3,7 @@ const SingleUseTokenProvider = require('../../../core/server/services/members/Si const settingsService = require('../../../core/server/services/settings/settings-service'); const settingsCache = require('../../../core/shared/settings-cache'); const {agentProvider, fixtureManager, mockManager, matchers} = require('../../utils/e2e-framework'); -const {stringMatching, anyEtag, anyUuid} = matchers; +const {stringMatching, anyEtag, anyUuid, anyStringNumber} = matchers; const models = require('../../../core/server/models'); const {anyErrorId} = matchers; @@ -63,7 +63,9 @@ describe('Settings API', function () { settings: matchSettingsArray(CURRENT_SETTINGS_COUNT) }) .matchHeaderSnapshot({ - etag: anyEtag + etag: anyEtag, + // Special rule for this test, as the labs setting changes a lot + 'content-length': anyStringNumber }); });