mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
138 lines
5.1 KiB
Text
138 lines
5.1 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": "canary",
|
||
|
"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",
|
||
|
"status": "available",
|
||
|
"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": "414",
|
||
|
"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": "canary",
|
||
|
"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",
|
||
|
"status": "available",
|
||
|
"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": "418",
|
||
|
"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,
|
||
|
"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": "250",
|
||
|
"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,
|
||
|
"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": "359",
|
||
|
"content-type": "application/json; charset=utf-8",
|
||
|
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||
|
"vary": "Origin, Accept-Encoding",
|
||
|
"x-powered-by": "Express",
|
||
|
}
|
||
|
`;
|