Moved Ghost agent matcher to common framework

refs a499f866f3
refs d817e5830d

- The user-agent used in outgoing Ghost requests (webhooks mostly) is dependent on the Ghost version - snapshots break if the matcher is not dynamic.
- There will be a few more webhooks tests coming soon, so makes sense to have this matcher moved to a common "framework matchers"
This commit is contained in:
Naz 2022-10-06 08:56:10 +08:00
parent 57f09fc8b7
commit fe1d0e44b4
No known key found for this signature in database
2 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,5 @@
const {agentProvider, mockManager, fixtureManager, matchers} = require('../utils/e2e-framework');
const {stringMatching, anyObjectId, anyISODateTime, anyUuid, anyContentVersion, anyNumber, anyLocalURL} = matchers;
const {anyGhostAgent, anyObjectId, anyISODateTime, anyUuid, anyContentVersion, anyNumber, anyLocalURL} = matchers;
const tierSnapshot = {
id: anyObjectId,
@ -7,8 +7,6 @@ const tierSnapshot = {
updated_at: anyISODateTime
};
const anyGhostAgent = stringMatching(/Ghost\/\d+\.\d+\.\d+\s\(https:\/\/github.com\/TryGhost\/Ghost\)/);
const buildAuthorSnapshot = (roles = false) => {
const authorSnapshot = {
last_seen: anyISODateTime,

View File

@ -380,6 +380,7 @@ module.exports = {
anyLocationFor: (resource) => {
return stringMatching(new RegExp(`https?://.*?/${resource}/[a-f0-9]{24}/`));
},
anyGhostAgent: stringMatching(/Ghost\/\d+\.\d+\.\d+\s\(https:\/\/github.com\/TryGhost\/Ghost\)/),
// @NOTE: hack here! it's due to https://github.com/TryGhost/Toolbox/issues/341
// this matcher should be removed once the issue is solved - routing is redesigned
// An ideal solution would be removal of this matcher altogether.