Fixed e2e Admin API posts test

refs 9471384020

- previously added tests for browse endpoint were not using matchers that sufficiently covered the dynamic portions of the body
This commit is contained in:
Kevin Ansfield 2022-09-13 14:05:03 +01:00
parent 9471384020
commit eebdb1d5df
2 changed files with 56 additions and 573 deletions

View File

@ -14,43 +14,7 @@ Object {
},
"posts": Array [
Object {
"authors": Array [
Object {
"accessibility": null,
"bio": "bio",
"comment_notifications": true,
"cover_image": null,
"created_at": "2022-09-13T12:17:08.000Z",
"email": "jbloggs@example.com",
"facebook": null,
"free_member_signup_notification": true,
"id": "1",
"last_seen": "2022-09-13T12:17:09.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": "2022-09-13T12:17:07.000Z",
"description": "Blog Owner",
"id": "632074c3082a107f3a4b0324",
"name": "Owner",
"updated_at": "2022-09-13T12:17:07.000Z",
},
],
"slug": "joe-bloggs",
"status": "active",
"tour": null,
"twitter": null,
"updated_at": "2022-09-13T12:17:09.000Z",
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
"website": null,
},
],
"authors": Any<Array>,
"canonical_url": null,
"codeinjection_foot": null,
"codeinjection_head": null,
@ -59,7 +23,7 @@ Object {
"conversions": 0,
"signups": 0,
},
"created_at": "2022-09-13T12:17:07.000Z",
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"custom_excerpt": null,
"custom_template": null,
"email": null,
@ -80,125 +44,24 @@ Object {
"og_description": null,
"og_image": null,
"og_title": null,
"primary_author": Object {
"accessibility": null,
"bio": "bio",
"comment_notifications": true,
"cover_image": null,
"created_at": "2022-09-13T12:17:08.000Z",
"email": "jbloggs@example.com",
"facebook": null,
"free_member_signup_notification": true,
"id": "1",
"last_seen": "2022-09-13T12:17:09.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": "2022-09-13T12:17:07.000Z",
"description": "Blog Owner",
"id": "632074c3082a107f3a4b0324",
"name": "Owner",
"updated_at": "2022-09-13T12:17:07.000Z",
},
],
"slug": "joe-bloggs",
"status": "active",
"tour": null,
"twitter": null,
"updated_at": "2022-09-13T12:17:09.000Z",
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
"website": null,
},
"primary_tag": null,
"published_at": "2022-09-15T12:17:07.000Z",
"primary_author": Any<Object>,
"primary_tag": Any<Object>,
"published_at": "2022-09-15T13:03:16.000Z",
"slug": "scheduled-post",
"status": "scheduled",
"tags": Array [],
"tiers": Array [
Object {
"active": true,
"created_at": "2022-09-13T12:17:07.000Z",
"description": null,
"id": "632074c3082a107f3a4b032b",
"monthly_price_id": null,
"name": "Default Product",
"slug": "default-product",
"trial_days": 0,
"type": "paid",
"updated_at": "2022-09-13T12:17:07.000Z",
"visibility": "public",
"welcome_page_url": null,
"yearly_price_id": null,
},
Object {
"active": true,
"created_at": "2022-09-13T12:17:07.000Z",
"description": null,
"id": "632074c3082a107f3a4b032c",
"monthly_price_id": null,
"name": "Free",
"slug": "free",
"trial_days": 0,
"type": "free",
"updated_at": "2022-09-13T12:17:07.000Z",
"visibility": "public",
"welcome_page_url": null,
"yearly_price_id": null,
},
],
"tags": Any<Array>,
"tiers": Any<Array>,
"title": "This is a scheduled post!!",
"twitter_description": null,
"twitter_image": null,
"twitter_title": null,
"updated_at": "2022-09-13T12:17:07.000Z",
"url": "http://127.0.0.1:2369/p/fc6b0029-2565-4350-8265-78019c81301e/",
"uuid": "fc6b0029-2565-4350-8265-78019c81301e",
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"url": Any<String>,
"uuid": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
"visibility": "public",
},
Object {
"authors": Array [
Object {
"accessibility": null,
"bio": "bio",
"comment_notifications": true,
"cover_image": null,
"created_at": "2022-09-13T12:17:08.000Z",
"email": "jbloggs@example.com",
"facebook": null,
"free_member_signup_notification": true,
"id": "1",
"last_seen": "2022-09-13T12:17:09.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": "2022-09-13T12:17:07.000Z",
"description": "Blog Owner",
"id": "632074c3082a107f3a4b0324",
"name": "Owner",
"updated_at": "2022-09-13T12:17:07.000Z",
},
],
"slug": "joe-bloggs",
"status": "active",
"tour": null,
"twitter": null,
"updated_at": "2022-09-13T12:17:09.000Z",
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
"website": null,
},
],
"authors": Any<Array>,
"canonical_url": null,
"codeinjection_foot": null,
"codeinjection_head": null,
@ -207,7 +70,7 @@ Object {
"conversions": 0,
"signups": 0,
},
"created_at": "2022-09-13T12:17:07.000Z",
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"custom_excerpt": null,
"custom_template": null,
"email": null,
@ -230,131 +93,20 @@ Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac tu
"og_description": null,
"og_image": null,
"og_title": null,
"primary_author": Object {
"accessibility": null,
"bio": "bio",
"comment_notifications": true,
"cover_image": null,
"created_at": "2022-09-13T12:17:08.000Z",
"email": "jbloggs@example.com",
"facebook": null,
"free_member_signup_notification": true,
"id": "1",
"last_seen": "2022-09-13T12:17:09.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": "2022-09-13T12:17:07.000Z",
"description": "Blog Owner",
"id": "632074c3082a107f3a4b0324",
"name": "Owner",
"updated_at": "2022-09-13T12:17:07.000Z",
},
],
"slug": "joe-bloggs",
"status": "active",
"tour": null,
"twitter": null,
"updated_at": "2022-09-13T12:17:09.000Z",
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
"website": null,
},
"primary_tag": Object {
"accent_color": null,
"canonical_url": null,
"codeinjection_foot": null,
"codeinjection_head": null,
"created_at": "2022-09-13T12:17:07.000Z",
"description": "description",
"feature_image": null,
"id": "6193c6d5e792de832cd08148",
"meta_description": null,
"meta_title": null,
"name": "pollo",
"og_description": null,
"og_image": null,
"og_title": null,
"slug": "pollo",
"twitter_description": null,
"twitter_image": null,
"twitter_title": null,
"updated_at": "2022-09-13T12:17:07.000Z",
"url": "http://127.0.0.1:2369/404/",
"visibility": "public",
},
"published_at": "2022-09-13T12:17:07.000Z",
"primary_author": Any<Object>,
"primary_tag": Any<Object>,
"published_at": "2022-09-13T13:03:16.000Z",
"slug": "unfinished",
"status": "draft",
"tags": Array [
Object {
"accent_color": null,
"canonical_url": null,
"codeinjection_foot": null,
"codeinjection_head": null,
"created_at": "2022-09-13T12:17:07.000Z",
"description": "description",
"feature_image": null,
"id": "6193c6d5e792de832cd08148",
"meta_description": null,
"meta_title": null,
"name": "pollo",
"og_description": null,
"og_image": null,
"og_title": null,
"slug": "pollo",
"twitter_description": null,
"twitter_image": null,
"twitter_title": null,
"updated_at": "2022-09-13T12:17:07.000Z",
"url": "http://127.0.0.1:2369/404/",
"visibility": "public",
},
],
"tiers": Array [
Object {
"active": true,
"created_at": "2022-09-13T12:17:07.000Z",
"description": null,
"id": "632074c3082a107f3a4b032b",
"monthly_price_id": null,
"name": "Default Product",
"slug": "default-product",
"trial_days": 0,
"type": "paid",
"updated_at": "2022-09-13T12:17:07.000Z",
"visibility": "public",
"welcome_page_url": null,
"yearly_price_id": null,
},
Object {
"active": true,
"created_at": "2022-09-13T12:17:07.000Z",
"description": null,
"id": "632074c3082a107f3a4b032c",
"monthly_price_id": null,
"name": "Free",
"slug": "free",
"trial_days": 0,
"type": "free",
"updated_at": "2022-09-13T12:17:07.000Z",
"visibility": "public",
"welcome_page_url": null,
"yearly_price_id": null,
},
],
"tags": Any<Array>,
"tiers": Any<Array>,
"title": "Not finished yet",
"twitter_description": null,
"twitter_image": null,
"twitter_title": null,
"updated_at": "2022-09-13T12:17:07.000Z",
"url": "http://127.0.0.1:2369/p/d52c42ae-2755-455c-80ec-70b2ec55c903/",
"uuid": "d52c42ae-2755-455c-80ec-70b2ec55c903",
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"url": Any<String>,
"uuid": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
"visibility": "public",
},
],
@ -387,43 +139,7 @@ Object {
},
"posts": Array [
Object {
"authors": Array [
Object {
"accessibility": null,
"bio": "bio",
"comment_notifications": true,
"cover_image": null,
"created_at": "2022-09-13T12:17:08.000Z",
"email": "jbloggs@example.com",
"facebook": null,
"free_member_signup_notification": true,
"id": "1",
"last_seen": "2022-09-13T12:17:09.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": "2022-09-13T12:17:07.000Z",
"description": "Blog Owner",
"id": "632074c3082a107f3a4b0324",
"name": "Owner",
"updated_at": "2022-09-13T12:17:07.000Z",
},
],
"slug": "joe-bloggs",
"status": "active",
"tour": null,
"twitter": null,
"updated_at": "2022-09-13T12:17:09.000Z",
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
"website": null,
},
],
"authors": Any<Array>,
"canonical_url": null,
"codeinjection_foot": null,
"codeinjection_head": null,
@ -432,7 +148,7 @@ Object {
"conversions": 0,
"signups": 0,
},
"created_at": "2022-09-13T12:17:07.000Z",
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"custom_excerpt": null,
"custom_template": null,
"email": null,
@ -456,126 +172,25 @@ Object {
"og_image": null,
"og_title": null,
"plaintext": "Welcome to my invisible post!",
"primary_author": Object {
"accessibility": null,
"bio": "bio",
"comment_notifications": true,
"cover_image": null,
"created_at": "2022-09-13T12:17:08.000Z",
"email": "jbloggs@example.com",
"facebook": null,
"free_member_signup_notification": true,
"id": "1",
"last_seen": "2022-09-13T12:17:09.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": "2022-09-13T12:17:07.000Z",
"description": "Blog Owner",
"id": "632074c3082a107f3a4b0324",
"name": "Owner",
"updated_at": "2022-09-13T12:17:07.000Z",
},
],
"slug": "joe-bloggs",
"status": "active",
"tour": null,
"twitter": null,
"updated_at": "2022-09-13T12:17:09.000Z",
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
"website": null,
},
"primary_tag": null,
"published_at": "2022-09-15T12:17:07.000Z",
"primary_author": Any<Object>,
"primary_tag": Any<Object>,
"published_at": "2022-09-15T13:03:16.000Z",
"reading_time": 0,
"slug": "scheduled-post",
"status": "scheduled",
"tags": Array [],
"tiers": Array [
Object {
"active": true,
"created_at": "2022-09-13T12:17:07.000Z",
"description": null,
"id": "632074c3082a107f3a4b032b",
"monthly_price_id": null,
"name": "Default Product",
"slug": "default-product",
"trial_days": 0,
"type": "paid",
"updated_at": "2022-09-13T12:17:07.000Z",
"visibility": "public",
"welcome_page_url": null,
"yearly_price_id": null,
},
Object {
"active": true,
"created_at": "2022-09-13T12:17:07.000Z",
"description": null,
"id": "632074c3082a107f3a4b032c",
"monthly_price_id": null,
"name": "Free",
"slug": "free",
"trial_days": 0,
"type": "free",
"updated_at": "2022-09-13T12:17:07.000Z",
"visibility": "public",
"welcome_page_url": null,
"yearly_price_id": null,
},
],
"tags": Any<Array>,
"tiers": Any<Array>,
"title": "This is a scheduled post!!",
"twitter_description": null,
"twitter_image": null,
"twitter_title": null,
"updated_at": "2022-09-13T12:17:07.000Z",
"url": "http://127.0.0.1:2369/p/fc6b0029-2565-4350-8265-78019c81301e/",
"uuid": "fc6b0029-2565-4350-8265-78019c81301e",
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"url": Any<String>,
"uuid": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
"visibility": "public",
},
Object {
"authors": Array [
Object {
"accessibility": null,
"bio": "bio",
"comment_notifications": true,
"cover_image": null,
"created_at": "2022-09-13T12:17:08.000Z",
"email": "jbloggs@example.com",
"facebook": null,
"free_member_signup_notification": true,
"id": "1",
"last_seen": "2022-09-13T12:17:09.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": "2022-09-13T12:17:07.000Z",
"description": "Blog Owner",
"id": "632074c3082a107f3a4b0324",
"name": "Owner",
"updated_at": "2022-09-13T12:17:07.000Z",
},
],
"slug": "joe-bloggs",
"status": "active",
"tour": null,
"twitter": null,
"updated_at": "2022-09-13T12:17:09.000Z",
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
"website": null,
},
],
"authors": Any<Array>,
"canonical_url": null,
"codeinjection_foot": null,
"codeinjection_head": null,
@ -584,7 +199,7 @@ Object {
"conversions": 0,
"signups": 0,
},
"created_at": "2022-09-13T12:17:07.000Z",
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"custom_excerpt": null,
"custom_template": null,
"email": null,
@ -628,132 +243,21 @@ Header Level 3
* Aliquam tincidunt mauris eu risus.
#header h1 a{display: block;width: 300px;height: 80px;}",
"primary_author": Object {
"accessibility": null,
"bio": "bio",
"comment_notifications": true,
"cover_image": null,
"created_at": "2022-09-13T12:17:08.000Z",
"email": "jbloggs@example.com",
"facebook": null,
"free_member_signup_notification": true,
"id": "1",
"last_seen": "2022-09-13T12:17:09.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": "2022-09-13T12:17:07.000Z",
"description": "Blog Owner",
"id": "632074c3082a107f3a4b0324",
"name": "Owner",
"updated_at": "2022-09-13T12:17:07.000Z",
},
],
"slug": "joe-bloggs",
"status": "active",
"tour": null,
"twitter": null,
"updated_at": "2022-09-13T12:17:09.000Z",
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
"website": null,
},
"primary_tag": Object {
"accent_color": null,
"canonical_url": null,
"codeinjection_foot": null,
"codeinjection_head": null,
"created_at": "2022-09-13T12:17:07.000Z",
"description": "description",
"feature_image": null,
"id": "6193c6d5e792de832cd08148",
"meta_description": null,
"meta_title": null,
"name": "pollo",
"og_description": null,
"og_image": null,
"og_title": null,
"slug": "pollo",
"twitter_description": null,
"twitter_image": null,
"twitter_title": null,
"updated_at": "2022-09-13T12:17:07.000Z",
"url": "http://127.0.0.1:2369/404/",
"visibility": "public",
},
"published_at": "2022-09-13T12:17:07.000Z",
"primary_author": Any<Object>,
"primary_tag": Any<Object>,
"published_at": "2022-09-13T13:03:16.000Z",
"reading_time": 1,
"slug": "unfinished",
"status": "draft",
"tags": Array [
Object {
"accent_color": null,
"canonical_url": null,
"codeinjection_foot": null,
"codeinjection_head": null,
"created_at": "2022-09-13T12:17:07.000Z",
"description": "description",
"feature_image": null,
"id": "6193c6d5e792de832cd08148",
"meta_description": null,
"meta_title": null,
"name": "pollo",
"og_description": null,
"og_image": null,
"og_title": null,
"slug": "pollo",
"twitter_description": null,
"twitter_image": null,
"twitter_title": null,
"updated_at": "2022-09-13T12:17:07.000Z",
"url": "http://127.0.0.1:2369/404/",
"visibility": "public",
},
],
"tiers": Array [
Object {
"active": true,
"created_at": "2022-09-13T12:17:07.000Z",
"description": null,
"id": "632074c3082a107f3a4b032b",
"monthly_price_id": null,
"name": "Default Product",
"slug": "default-product",
"trial_days": 0,
"type": "paid",
"updated_at": "2022-09-13T12:17:07.000Z",
"visibility": "public",
"welcome_page_url": null,
"yearly_price_id": null,
},
Object {
"active": true,
"created_at": "2022-09-13T12:17:07.000Z",
"description": null,
"id": "632074c3082a107f3a4b032c",
"monthly_price_id": null,
"name": "Free",
"slug": "free",
"trial_days": 0,
"type": "free",
"updated_at": "2022-09-13T12:17:07.000Z",
"visibility": "public",
"welcome_page_url": null,
"yearly_price_id": null,
},
],
"tags": Any<Array>,
"tiers": Any<Array>,
"title": "Not finished yet",
"twitter_description": null,
"twitter_image": null,
"twitter_title": null,
"updated_at": "2022-09-13T12:17:07.000Z",
"url": "http://127.0.0.1:2369/p/d52c42ae-2755-455c-80ec-70b2ec55c903/",
"uuid": "d52c42ae-2755-455c-80ec-70b2ec55c903",
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"url": Any<String>,
"uuid": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
"visibility": "public",
},
],
@ -772,36 +276,6 @@ Object {
}
`;
exports[`Posts API Cannot delete a non-existent posts 1: [body] 1`] = `
Object {
"errors": Array [
Object {
"code": null,
"context": "Post not found.",
"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": "Resource not found error, cannot delete post.",
"property": null,
"type": "NotFoundError",
},
],
}
`;
exports[`Posts API Cannot delete a non-existent posts 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": "244",
"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[`Posts API Delete Can destroy a post 1: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",

View File

@ -1,6 +1,19 @@
const assert = require('assert');
const {agentProvider, fixtureManager, mockManager, matchers} = require('../../utils/e2e-framework');
const {anyEtag, anyErrorId, anyObjectId} = matchers;
const {anyArray, anyEtag, anyErrorId, anyObject, anyObjectId, anyISODateTime, anyString, anyUuid} = matchers;
const matchPostShallowIncludes = {
id: anyObjectId,
uuid: anyUuid,
url: anyString,
authors: anyArray,
primary_author: anyObject,
tags: anyArray,
primary_tag: anyObject,
tiers: anyArray,
created_at: anyISODateTime,
updated_at: anyISODateTime
};
describe('Posts API', function () {
let agent;
@ -22,9 +35,7 @@ describe('Posts API', function () {
etag: anyEtag
})
.matchBodySnapshot({
posts: new Array(2).fill({
id: anyObjectId
})
posts: new Array(2).fill(matchPostShallowIncludes)
});
});
@ -35,9 +46,7 @@ describe('Posts API', function () {
etag: anyEtag
})
.matchBodySnapshot({
posts: new Array(2).fill({
id: anyObjectId
})
posts: new Array(2).fill(matchPostShallowIncludes)
});
});