mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
Added e2e tests for page.tag.detached
webhook (#15651)
refs: https://github.com/TryGhost/Ghost/issues/15537 - snapshot test created to add confidence to webhook stability and increase overall test coverage.
This commit is contained in:
parent
5fe6687c2a
commit
3f289edc26
@ -359,6 +359,218 @@ Object {
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`page.* events page.published event is triggered 1: [headers] 1`] = `
|
||||
Object {
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"content-length": Any<Number>,
|
||||
"content-type": "application/json",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"user-agent": StringMatching /Ghost\\\\/\\\\d\\+\\\\\\.\\\\d\\+\\\\\\.\\\\d\\+\\\\s\\\\\\(https:\\\\/\\\\/github\\.com\\\\/TryGhost\\\\/Ghost\\\\\\)/,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`page.* events page.published event is triggered 2: [body] 1`] = `
|
||||
Object {
|
||||
"page": Object {
|
||||
"current": Object {
|
||||
"authors": Array [
|
||||
Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"description": "Blog Owner",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"name": "Owner",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"url": StringMatching /http:\\\\/\\\\/127\\.0\\.0\\.1:2369\\\\/\\[A-Za-z0-9_-\\]\\+\\\\//,
|
||||
"website": null,
|
||||
},
|
||||
],
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"comment_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"count": Object {
|
||||
"negative_feedback": 0,
|
||||
"paid_conversions": 0,
|
||||
"positive_feedback": 0,
|
||||
"signups": 0,
|
||||
},
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"custom_excerpt": null,
|
||||
"custom_template": null,
|
||||
"excerpt": null,
|
||||
"feature_image": null,
|
||||
"feature_image_alt": null,
|
||||
"feature_image_caption": null,
|
||||
"featured": false,
|
||||
"frontmatter": null,
|
||||
"html": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"mobiledoc": "{\\"version\\":\\"0.3.1\\",\\"ghostVersion\\":\\"4.0\\",\\"markups\\":[],\\"atoms\\":[],\\"cards\\":[],\\"sections\\":[[1,\\"p\\",[[0,[],0,\\"\\"]]]]}",
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"primary_author": Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"description": "Blog Owner",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"name": "Owner",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"url": StringMatching /http:\\\\/\\\\/127\\.0\\.0\\.1:2369\\\\/\\[A-Za-z0-9_-\\]\\+\\\\//,
|
||||
"website": null,
|
||||
},
|
||||
"primary_tag": null,
|
||||
"published_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"slug": "testing-page-published-webhook",
|
||||
"status": "published",
|
||||
"tags": Array [],
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"currency": "usd",
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"monthly_price": 500,
|
||||
"monthly_price_id": null,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price": 5000,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"currency": null,
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"monthly_price": null,
|
||||
"monthly_price_id": null,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
],
|
||||
"title": "testing page.published webhook",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"url": StringMatching /http:\\\\/\\\\/127\\.0\\.0\\.1:2369\\\\/\\[A-Za-z0-9_-\\]\\+\\\\//,
|
||||
"uuid": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
|
||||
"visibility": "public",
|
||||
},
|
||||
"previous": Object {
|
||||
"published_at": null,
|
||||
"status": "draft",
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"currency": "usd",
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"monthly_price": 500,
|
||||
"monthly_price_id": null,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price": 5000,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"currency": null,
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"monthly_price": null,
|
||||
"monthly_price_id": null,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
],
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`page.* events page.scheduled event is triggered 1: [headers] 1`] = `
|
||||
Object {
|
||||
"accept-encoding": "gzip, deflate",
|
||||
@ -571,6 +783,202 @@ Object {
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`page.* events page.tag.detached event is triggered 1: [headers] 1`] = `
|
||||
Object {
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"content-length": Any<Number>,
|
||||
"content-type": "application/json",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"user-agent": StringMatching /Ghost\\\\/\\\\d\\+\\\\\\.\\\\d\\+\\\\\\.\\\\d\\+\\\\s\\\\\\(https:\\\\/\\\\/github\\.com\\\\/TryGhost\\\\/Ghost\\\\\\)/,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`page.* events page.tag.detached event is triggered 2: [body] 1`] = `
|
||||
Object {
|
||||
"page": Object {
|
||||
"current": Object {
|
||||
"authors": Array [
|
||||
Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"description": "Blog Owner",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"name": "Owner",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"url": StringMatching /http:\\\\/\\\\/127\\.0\\.0\\.1:2369\\\\/\\[A-Za-z0-9_-\\]\\+\\\\//,
|
||||
"website": null,
|
||||
},
|
||||
],
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"comment_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"count": Object {
|
||||
"negative_feedback": 0,
|
||||
"paid_conversions": 0,
|
||||
"positive_feedback": 0,
|
||||
"signups": 0,
|
||||
},
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"custom_excerpt": null,
|
||||
"custom_template": null,
|
||||
"excerpt": null,
|
||||
"feature_image": null,
|
||||
"feature_image_alt": null,
|
||||
"feature_image_caption": null,
|
||||
"featured": false,
|
||||
"frontmatter": null,
|
||||
"html": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"mobiledoc": "{\\"version\\":\\"0.3.1\\",\\"ghostVersion\\":\\"4.0\\",\\"markups\\":[],\\"atoms\\":[],\\"cards\\":[],\\"sections\\":[[1,\\"p\\",[[0,[],0,\\"\\"]]]]}",
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"primary_author": Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"description": "Blog Owner",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"name": "Owner",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"url": StringMatching /http:\\\\/\\\\/127\\.0\\.0\\.1:2369\\\\/\\[A-Za-z0-9_-\\]\\+\\\\//,
|
||||
"website": null,
|
||||
},
|
||||
"primary_tag": null,
|
||||
"published_at": null,
|
||||
"slug": "test-page-tag-detached-webhook",
|
||||
"status": "draft",
|
||||
"tags": Array [],
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"currency": "usd",
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"monthly_price": 500,
|
||||
"monthly_price_id": null,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price": 5000,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"currency": null,
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"monthly_price": null,
|
||||
"monthly_price_id": null,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
],
|
||||
"title": "test page.tag.detached webhook",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"url": StringMatching /http:\\\\/\\\\/127\\.0\\.0\\.1:2369\\\\/\\[A-Za-z0-9_-\\]\\+\\\\//,
|
||||
"uuid": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
|
||||
"visibility": "public",
|
||||
},
|
||||
"previous": Object {
|
||||
"tags": Array [
|
||||
Object {
|
||||
"accent_color": null,
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"description": null,
|
||||
"feature_image": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Testing TAGS",
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"slug": "testing-tags",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"url": "http://127.0.0.1:2369/404/",
|
||||
"visibility": "public",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`page.* events page.unpublished event is triggered 1: [headers] 1`] = `
|
||||
Object {
|
||||
"accept-encoding": "gzip, deflate",
|
||||
|
@ -12,7 +12,8 @@ const {
|
||||
anyISODateTime,
|
||||
anyObjectId,
|
||||
anyContentVersion,
|
||||
anyNumber
|
||||
anyNumber,
|
||||
anyString
|
||||
} = matchers;
|
||||
|
||||
const tierSnapshot = {
|
||||
@ -21,6 +22,7 @@ const tierSnapshot = {
|
||||
updated_at: anyISODateTime
|
||||
};
|
||||
|
||||
const tagSnapshot = tierSnapshot;
|
||||
const roleSnapshot = tierSnapshot;
|
||||
|
||||
const buildAuthorSnapshot = (roles = false) => {
|
||||
@ -41,6 +43,7 @@ const buildAuthorSnapshot = (roles = false) => {
|
||||
const buildPageSnapshotWithTiers = ({
|
||||
published,
|
||||
tiersCount,
|
||||
tags = false,
|
||||
roles = false
|
||||
}) => {
|
||||
return {
|
||||
@ -53,7 +56,9 @@ const buildPageSnapshotWithTiers = ({
|
||||
url: anyLocalURL,
|
||||
tiers: new Array(tiersCount).fill(tierSnapshot),
|
||||
primary_author: buildAuthorSnapshot(roles),
|
||||
authors: new Array(1).fill(buildAuthorSnapshot(roles))
|
||||
authors: new Array(1).fill(buildAuthorSnapshot(roles)),
|
||||
primary_tag: tags ? tagSnapshot : null,
|
||||
tags: tags ? new Array(1).fill(tagSnapshot) : []
|
||||
};
|
||||
};
|
||||
|
||||
@ -64,6 +69,18 @@ const buildPreviousPageSnapshotWithTiers = (tiersCount) => {
|
||||
};
|
||||
};
|
||||
|
||||
const buildPreviousPageSnapshotWithTiersAndTags = ({tiersCount, tags}) => {
|
||||
const prevSnap = {
|
||||
tags: tags ? new Array(1).fill(tagSnapshot) : []
|
||||
};
|
||||
|
||||
if (tiersCount > 0) {
|
||||
prevSnap.tiers = new Array(tiersCount).fill(tierSnapshot);
|
||||
}
|
||||
|
||||
return prevSnap;
|
||||
};
|
||||
|
||||
describe('page.* events', function () {
|
||||
let adminAPIAgent;
|
||||
let webhookMockReceiver;
|
||||
@ -82,6 +99,57 @@ describe('page.* events', function () {
|
||||
mockManager.restore();
|
||||
});
|
||||
|
||||
it('page.published event is triggered', async function () {
|
||||
const webhookURL = 'https://test-webhook-receiver.com/page-published/';
|
||||
await webhookMockReceiver.mock(webhookURL);
|
||||
await fixtureManager.insertWebhook({
|
||||
event: 'page.published',
|
||||
url: webhookURL
|
||||
});
|
||||
|
||||
const res = await adminAPIAgent
|
||||
.post('pages/')
|
||||
.body({
|
||||
pages: [
|
||||
{
|
||||
title: 'testing page.published webhook',
|
||||
status: 'draft'
|
||||
}
|
||||
]
|
||||
})
|
||||
.expectStatus(201);
|
||||
|
||||
const id = res.body.pages[0].id;
|
||||
const publishedPage = res.body.pages[0];
|
||||
publishedPage.status = 'published';
|
||||
|
||||
await adminAPIAgent
|
||||
.put('pages/' + id)
|
||||
.body({
|
||||
pages: [publishedPage]
|
||||
})
|
||||
.expectStatus(200);
|
||||
|
||||
await webhookMockReceiver.receivedRequest();
|
||||
|
||||
webhookMockReceiver
|
||||
.matchHeaderSnapshot({
|
||||
'content-version': anyContentVersion,
|
||||
'content-length': anyNumber,
|
||||
'user-agent': anyGhostAgent
|
||||
})
|
||||
.matchBodySnapshot({
|
||||
page: {
|
||||
current: buildPageSnapshotWithTiers({
|
||||
published: true,
|
||||
tiersCount: 2,
|
||||
roles: true
|
||||
}),
|
||||
previous: buildPreviousPageSnapshotWithTiers(2)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('page.added event is triggered', async function () {
|
||||
const webhookURL = 'https://test-webhook-receiver.com/page-added/';
|
||||
await webhookMockReceiver.mock(webhookURL);
|
||||
@ -276,4 +344,66 @@ describe('page.* events', function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('page.tag.detached event is triggered', async function () {
|
||||
const webhookURL = 'https://test-webhook-receiver.com/page-tag-detached/';
|
||||
await webhookMockReceiver.mock(webhookURL);
|
||||
await fixtureManager.insertWebhook({
|
||||
event: 'page.tag.detached',
|
||||
url: webhookURL
|
||||
});
|
||||
|
||||
const res = await adminAPIAgent
|
||||
.post('pages/')
|
||||
.body({
|
||||
pages: [
|
||||
{
|
||||
title: 'test page.tag.detached webhook',
|
||||
status: 'draft'
|
||||
}
|
||||
]
|
||||
})
|
||||
.expectStatus(201);
|
||||
const id = res.body.pages[0].id;
|
||||
const updatedPage = res.body.pages[0];
|
||||
updatedPage.tags = ['Testing TAGS'];
|
||||
await adminAPIAgent
|
||||
.put('pages/' + id)
|
||||
.body({
|
||||
pages: [updatedPage]
|
||||
})
|
||||
.expectStatus(200);
|
||||
|
||||
updatedPage.tags = [];
|
||||
|
||||
await adminAPIAgent
|
||||
.put('pages/' + id)
|
||||
.body({
|
||||
pages: [updatedPage]
|
||||
})
|
||||
.expectStatus(200);
|
||||
|
||||
await webhookMockReceiver.receivedRequest();
|
||||
|
||||
webhookMockReceiver
|
||||
.matchHeaderSnapshot({
|
||||
'content-version': anyContentVersion,
|
||||
'content-length': anyNumber,
|
||||
'user-agent': anyGhostAgent
|
||||
})
|
||||
.matchBodySnapshot({
|
||||
page: {
|
||||
current: buildPageSnapshotWithTiers({
|
||||
published: false,
|
||||
tiersCount: 2,
|
||||
roles: true,
|
||||
tags: false
|
||||
}),
|
||||
previous: buildPreviousPageSnapshotWithTiersAndTags({
|
||||
tiersCount: 0,
|
||||
tags: true
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user