0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/test/e2e-api/admin/__snapshots__/webhooks.test.js.snap
Naz c3d38a9144 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?)
2022-05-19 14:19:48 +08:00

137 lines
5.2 KiB
Text

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Webhooks API Can create a webhook 1: [body] 1`] = `
Object {
"webhooks": Array [
Object {
"api_version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}/,
"event": "test.create",
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"integration_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"last_triggered_at": null,
"last_triggered_error": null,
"last_triggered_status": null,
"name": "test",
"secret": "thisissecret",
"target_url": "http://example.com/webhooks/test/extra/1",
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}/,
},
],
}
`;
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": StringMatching /\\\\d\\+/,
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
"x-powered-by": "Express",
}
`;
exports[`Webhooks API Can delete a webhook 1: [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",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin",
"x-powered-by": "Express",
}
`;
exports[`Webhooks API Can edit a webhook 1: [body] 1`] = `
Object {
"webhooks": Array [
Object {
"api_version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}/,
"event": "subscriber.added",
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"integration_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"last_triggered_at": null,
"last_triggered_error": null,
"last_triggered_status": null,
"name": "Edit Test",
"secret": "thisissecret",
"target_url": "https://example.com/new-subscriber",
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}/,
},
],
}
`;
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": StringMatching /\\\\d\\+/,
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
"x-powered-by": "Express",
}
`;
exports[`Webhooks API Fails nicely when adding a duplicate webhook 1: [body] 1`] = `
Object {
"errors": Array [
Object {
"code": null,
"context": "Target URL has already been used for this event.",
"details": null,
"ghostErrorCode": null,
"help": null,
"id": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
"message": "Validation error, cannot save webhook.",
"property": null,
"type": "ValidationError",
},
],
}
`;
exports[`Webhooks API Fails nicely when adding a duplicate 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": "272",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
"x-powered-by": "Express",
}
`;
exports[`Webhooks API Fails nicely when creating an orphaned webhook 1: [body] 1`] = `
Object {
"errors": Array [
Object {
"code": null,
"context": "Validation failed for 'integration_id'. 'integration_id' value does not match any existing integration.",
"details": null,
"ghostErrorCode": null,
"help": "Provide the 'integration_id' of an existing integration.",
"id": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
"message": "Validation error, cannot save webhook.",
"property": null,
"type": "ValidationError",
},
],
}
`;
exports[`Webhooks API Fails nicely when creating an orphaned 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": "381",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
"x-powered-by": "Express",
}
`;