0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Made tag snapshots more accurate in collections test suite

refs https://github.com/TryGhost/Arch/issues/46

- Allows to actually verify in the snapshot itself if the tag filter is working correctly or not.
This commit is contained in:
Naz 2023-07-24 17:08:46 +08:00 committed by naz
parent 3830401d55
commit c4351456c6
2 changed files with 103 additions and 3 deletions

View file

@ -211,7 +211,54 @@ Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac tu
"reading_time": 1,
"slug": "ghostly-kitchen-sink",
"status": "published",
"tags": Any<Array>,
"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": "description",
"feature_image": "https://example.com/super_photo.jpg",
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"meta_description": null,
"meta_title": null,
"name": "kitchen sink",
"og_description": null,
"og_image": null,
"og_title": null,
"slug": "kitchen-sink",
"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/tag/kitchen-sink/",
"visibility": "public",
},
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": "description",
"feature_image": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"meta_description": null,
"meta_title": null,
"name": "bacon",
"og_description": null,
"og_image": null,
"og_title": null,
"slug": "bacon",
"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/tag/bacon/",
"visibility": "public",
},
],
"tiers": Array [
Object {
"active": true,
@ -298,7 +345,54 @@ Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac tu
"reading_time": 1,
"slug": "html-ipsum",
"status": "published",
"tags": Any<Array>,
"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": "description",
"feature_image": "https://example.com/super_photo.jpg",
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"meta_description": null,
"meta_title": null,
"name": "kitchen sink",
"og_description": null,
"og_image": null,
"og_title": null,
"slug": "kitchen-sink",
"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/tag/kitchen-sink/",
"visibility": "public",
},
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": "description",
"feature_image": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"meta_description": null,
"meta_title": null,
"name": "bacon",
"og_description": null,
"og_image": null,
"og_title": null,
"slug": "bacon",
"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/tag/bacon/",
"visibility": "public",
},
],
"tiers": Array [
Object {
"active": true,

View file

@ -31,6 +31,12 @@ const tierSnapshot = {
updated_at: anyISODateTime
};
const tagSnapshotMatcher = {
id: anyObjectId,
created_at: anyISODateTime,
updated_at: anyISODateTime
};
const matchPostShallowIncludes = {
id: anyObjectId,
uuid: anyUuid,
@ -38,7 +44,7 @@ const matchPostShallowIncludes = {
url: anyString,
authors: anyArray,
primary_author: anyObject,
tags: anyArray,
tags: Array(2).fill(tagSnapshotMatcher),
primary_tag: anyObject,
tiers: Array(2).fill(tierSnapshot),
created_at: anyISODateTime,