mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Abstracted a hacky local URL matcher
refs https://github.com/TryGhost/Toolbox/issues/320 - The URL matcher is very likely to be reused in the future, so having it abstracted away gives two benefits: 1. Central place to document hacky behavior and easier future cleanup 2. The implementer of the e2e test does not have to see the "hacky note" and just concentrate on the implementation of the test
This commit is contained in:
parent
d817e5830d
commit
320c6e0dd3
@ -1,5 +1,5 @@
|
||||
const {agentProvider, mockManager, fixtureManager, matchers} = require('../utils/e2e-framework');
|
||||
const {anyObjectId, anyISODateTime, anyUuid, anyContentVersion, anyNumber, stringMatching} = matchers;
|
||||
const {anyObjectId, anyISODateTime, anyUuid, anyContentVersion, anyNumber, anyLocalURL} = matchers;
|
||||
|
||||
const tierSnapshot = {
|
||||
id: anyObjectId,
|
||||
@ -35,9 +35,7 @@ const buildPostSnapshotWithTiers = ({published, tiersCount, roles = false}) => {
|
||||
published_at: published ? anyISODateTime : null,
|
||||
created_at: anyISODateTime,
|
||||
updated_at: anyISODateTime,
|
||||
// @TODO: hack here! it's due to https://github.com/TryGhost/Toolbox/issues/341
|
||||
// this matcher should be removed once the issue is solved
|
||||
url: stringMatching(/http:\/\/127.0.0.1:2369\/\w+\//),
|
||||
url: anyLocalURL,
|
||||
tiers: new Array(tiersCount).fill(tierSnapshot),
|
||||
primary_author: buildAuthorSnapshot(roles),
|
||||
authors: new Array(1).fill(buildAuthorSnapshot(roles))
|
||||
|
@ -368,6 +368,10 @@ module.exports = {
|
||||
anyLocationFor: (resource) => {
|
||||
return stringMatching(new RegExp(`https?://.*?/${resource}/[a-f0-9]{24}/`));
|
||||
},
|
||||
// @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.
|
||||
anyLocalURL: stringMatching(/http:\/\/127.0.0.1:2369\/\w+\//),
|
||||
stringMatching
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user