2022-05-06 12:17:32 +01:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
exports[`Webhooks API Can create a webhook 1: [body] 1`] = `
|
|
|
|
Object {
|
|
|
|
"webhooks": Array [
|
|
|
|
Object {
|
2022-05-06 12:40:55 +01:00
|
|
|
"api_version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
2022-05-06 12:17:32 +01:00
|
|
|
"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",
|
2022-05-19 13:50:44 +08:00
|
|
|
"content-length": StringMatching /\\\\d\\+/,
|
2022-05-06 12:17:32 +01:00
|
|
|
"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 {
|
2022-05-06 12:40:55 +01:00
|
|
|
"api_version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
2022-05-06 12:17:32 +01:00
|
|
|
"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",
|
2022-05-19 13:50:44 +08:00
|
|
|
"content-length": StringMatching /\\\\d\\+/,
|
2022-05-06 12:17:32 +01:00
|
|
|
"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,
|
2022-05-07 15:28:28 +01:00
|
|
|
"ghostErrorCode": null,
|
2022-05-06 12:17:32 +01:00
|
|
|
"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",
|
2022-05-07 15:28:28 +01:00
|
|
|
"content-length": "272",
|
2022-05-06 12:17:32 +01:00
|
|
|
"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,
|
2022-05-07 15:28:28 +01:00
|
|
|
"ghostErrorCode": null,
|
2022-05-06 12:17:32 +01:00
|
|
|
"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",
|
2022-05-07 15:28:28 +01:00
|
|
|
"content-length": "381",
|
2022-05-06 12:17:32 +01:00
|
|
|
"content-type": "application/json; charset=utf-8",
|
|
|
|
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
|
|
|
"vary": "Origin, Accept-Encoding",
|
|
|
|
"x-powered-by": "Express",
|
|
|
|
}
|
|
|
|
`;
|