0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Prevented posts webhook tests from breaking on every release

This commit is contained in:
Simon Backx 2022-10-05 14:25:00 +02:00
parent f17934a5d2
commit a499f866f3
2 changed files with 9 additions and 5 deletions

View file

@ -6,7 +6,7 @@ Object {
"content-length": Any<Number>,
"content-type": "application/json",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
"user-agent": "Ghost/5.17.2 (https://github.com/TryGhost/Ghost)",
"user-agent": StringMatching /Ghost\\\\/\\\\d\\+\\\\\\.\\\\d\\+\\\\\\.\\\\d\\+\\\\s\\\\\\(https:\\\\/\\\\/github\\.com\\\\/TryGhost\\\\/Ghost\\\\\\)/,
}
`;
@ -150,7 +150,7 @@ Object {
"content-length": Any<Number>,
"content-type": "application/json",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
"user-agent": "Ghost/5.17.2 (https://github.com/TryGhost/Ghost)",
"user-agent": StringMatching /Ghost\\\\/\\\\d\\+\\\\\\.\\\\d\\+\\\\\\.\\\\d\\+\\\\s\\\\\\(https:\\\\/\\\\/github\\.com\\\\/TryGhost\\\\/Ghost\\\\\\)/,
}
`;

View file

@ -1,5 +1,5 @@
const {agentProvider, mockManager, fixtureManager, matchers} = require('../utils/e2e-framework');
const {anyObjectId, anyISODateTime, anyUuid, anyContentVersion, anyNumber, anyLocalURL} = matchers;
const {stringMatching, anyObjectId, anyISODateTime, anyUuid, anyContentVersion, anyNumber, anyLocalURL} = matchers;
const tierSnapshot = {
id: anyObjectId,
@ -7,6 +7,8 @@ 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,
@ -101,7 +103,8 @@ describe('post.* events', function () {
webhookMockReceiver
.matchHeaderSnapshot({
'content-version': anyContentVersion,
'content-length': anyNumber
'content-length': anyNumber,
'user-agent': anyGhostAgent
})
.matchBodySnapshot({
post: {
@ -140,7 +143,8 @@ describe('post.* events', function () {
webhookMockReceiver
.matchHeaderSnapshot({
'content-version': anyContentVersion,
'content-length': anyNumber
'content-length': anyNumber,
'user-agent': anyGhostAgent
})
.matchBodySnapshot({
post: {