Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 85341d4

Browse files
committed
chore: tested and verified the article data transformation
1 parent c938a82 commit 85341d4

File tree

7 files changed

+576
-31
lines changed

7 files changed

+576
-31
lines changed
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`mockTypesenseArticle 1`] = `
4+
{
5+
"authors": [
6+
{
7+
"avatar": "https://assets.stori.press/media/images/f3354bcf-a572-4fc0-8e3d-d19cbcfbc318.png",
8+
"bio": "<p>Sid Test</p>",
9+
"full_name": "Sidd Chang",
10+
"id": "242",
11+
"location": "T",
12+
"name": "Sidd Chang",
13+
"slug": "sidd-chang",
14+
"socials": [],
15+
},
16+
],
17+
"bio": "Sid Test",
18+
"bioHTML": "<p>Sid Test</p>",
19+
"blurb": "This is a mock article",
20+
"cover": {
21+
"alt": null,
22+
"caption": "<p>Photo by <a href=\\"https://unsplash.com/@kz29?utm_source=Storipress&utm_medium=referral&utm_campaign=api-credit?utm_source=storipress&utm_medium=referral&utm_campaign=api-credit\\">Keith Zhang</a> / <a href=\\"https://unsplash.com/?utm_source=storipress&utm_medium=referral&utm_campaign=api-credit\\">Unsplash</a></p>",
23+
"crop": {
24+
"height": 0,
25+
"key": "",
26+
"left": 50,
27+
"realHeight": 3024,
28+
"realWidth": 4032,
29+
"top": 50,
30+
"width": 0,
31+
"zoom": 1,
32+
},
33+
"url": "https://images.unsplash.com/photo-1704461539031-e7c2145e5fc4?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wyMzc2NzF8MHwxfGFsbHw5fHx8fHx8Mnx8MTcwNDc1ODc2Nnw&ixlib=rb-4.0.3&q=80&w=1080",
34+
},
35+
"desk": {
36+
"id": "119",
37+
"name": "test",
38+
"slug": "test-32",
39+
},
40+
"featured": false,
41+
"html": "",
42+
"id": "619",
43+
"order": 400,
44+
"pathnames": [
45+
"/posts/mock-article",
46+
"/posts/mock-article",
47+
"/posts/mock-article",
48+
"/posts/new-mock-article",
49+
"/posts/mock-article",
50+
],
51+
"plaintext": "",
52+
"plan": "free",
53+
"published_at": "2024-01-08T23:46:33.000Z",
54+
"seo": {
55+
"hasSlug": true,
56+
"meta": {
57+
"description": "Discover expert tips for boosting your website's visibility and driving traffic with our comprehensive SEO strategies guide. strategies guide.",
58+
"title": "SEO Title Tag: Essential Tips for Effective Article Writing Article Writing",
59+
},
60+
"og": {
61+
"description": "",
62+
"title": "",
63+
},
64+
"ogImage": "",
65+
},
66+
"slug": "mock-article-test",
67+
"tags": [
68+
{
69+
"id": "44",
70+
"name": "foo",
71+
"slug": "foo",
72+
},
73+
],
74+
"title": "Mock Article",
75+
"updated_at": 1704758778,
76+
}
77+
`;
78+
79+
exports[`mockTypesenseArticle 2`] = `
80+
{
81+
"authors": [
82+
{
83+
"avatar": "https://assets.stori.press/media/images/f3354bcf-a572-4fc0-8e3d-d19cbcfbc318.png",
84+
"bio": "<p>Sid Test</p>",
85+
"email": "sid+0705@storipress.com",
86+
"first_name": "Sidd",
87+
"full_name": "Sidd Chang",
88+
"id": "242",
89+
"last_name": "Chang",
90+
"location": "T",
91+
"name": "Sidd Chang",
92+
"slug": "sidd-chang",
93+
"socials": [],
94+
},
95+
],
96+
"bio": "Sid Test",
97+
"bioHTML": "<p>Sid Test</p>",
98+
"blurb": "This is a mock article",
99+
"content_blocks": [],
100+
"cover": {
101+
"alt": null,
102+
"caption": "<p>Photo by <a href=\\"https://unsplash.com/@kz29?utm_source=Storipress&utm_medium=referral&utm_campaign=api-credit?utm_source=storipress&utm_medium=referral&utm_campaign=api-credit\\">Keith Zhang</a> / <a href=\\"https://unsplash.com/?utm_source=storipress&utm_medium=referral&utm_campaign=api-credit\\">Unsplash</a></p>",
103+
"crop": {
104+
"height": 0,
105+
"key": "",
106+
"left": 50,
107+
"realHeight": 3024,
108+
"realWidth": 4032,
109+
"top": 50,
110+
"width": 0,
111+
"zoom": 1,
112+
},
113+
"url": "https://images.unsplash.com/photo-1704461539031-e7c2145e5fc4?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wyMzc2NzF8MHwxfGFsbHw5fHx8fHx8Mnx8MTcwNDc1ODc2Nnw&ixlib=rb-4.0.3&q=80&w=1080",
114+
},
115+
"desk": {
116+
"desk": null,
117+
"id": "119",
118+
"layout": null,
119+
"name": "test",
120+
"slug": "test-32",
121+
},
122+
"featured": false,
123+
"html": "<p>Mock Article Content</p>",
124+
"id": "619",
125+
"layout": null,
126+
"metafields": [
127+
{
128+
"group": {
129+
"id": "70",
130+
"key": "__layoutmeta",
131+
"type": "articleMetafield",
132+
},
133+
"id": "76",
134+
"key": "layoutid",
135+
"type": "text",
136+
"values": [],
137+
},
138+
{
139+
"group": {
140+
"id": "81",
141+
"key": "test",
142+
"type": "articleMetafield",
143+
},
144+
"id": "100",
145+
"key": "test",
146+
"type": "text",
147+
"values": [],
148+
},
149+
{
150+
"group": {
151+
"id": "82",
152+
"key": "webflow",
153+
"type": "articleMetafield",
154+
},
155+
"id": "104",
156+
"key": "color",
157+
"type": "color",
158+
"values": [],
159+
},
160+
{
161+
"group": {
162+
"id": "82",
163+
"key": "webflow",
164+
"type": "articleMetafield",
165+
},
166+
"id": "103",
167+
"key": "thumbnail-image",
168+
"type": "file",
169+
"values": [],
170+
},
171+
],
172+
"plaintext": "Mock Article Content",
173+
"plan": "free",
174+
"published_at": "2024-01-08T23:46:33+00:00",
175+
"relevances": [
176+
{
177+
"id": "21",
178+
"title": "When an editor thinks an article is",
179+
},
180+
{
181+
"id": "20",
182+
"title": "When a writer wants an editor to review their work, it goes here",
183+
},
184+
{
185+
"id": "24",
186+
"title": "Chris' First Article Chris' First ArticleChris' First ArticleChris' First ArticleChris' First ArticleChris' First Article",
187+
},
188+
{
189+
"id": "43",
190+
"title": "<p>&lt;c&gt;12345&lt;/c&gt;</p>",
191+
},
192+
{
193+
"id": "596",
194+
"title": "<p>New Article 2</p>",
195+
},
196+
{
197+
"id": "597",
198+
"title": "<p>New article 3</p>",
199+
},
200+
{
201+
"id": "598",
202+
"title": "<p>New article 4</p>",
203+
},
204+
],
205+
"seo": {
206+
"hasSlug": true,
207+
"meta": {
208+
"description": "Discover expert tips for boosting your website's visibility and driving traffic with our comprehensive SEO strategies guide. strategies guide.",
209+
"title": "SEO Title Tag: Essential Tips for Effective Article Writing Article Writing",
210+
},
211+
"og": {
212+
"description": "",
213+
"title": "",
214+
},
215+
"ogImage": "",
216+
},
217+
"shadow_authors": null,
218+
"slug": "mock-article-test",
219+
"tags": [
220+
{
221+
"id": "44",
222+
"name": "foo",
223+
"slug": "foo",
224+
},
225+
],
226+
"title": "Mock Article",
227+
"updated_at": "2024-01-09T00:32:10+00:00",
228+
}
229+
`;
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
import type { ArticlePlan } from '../../types'
2+
3+
export const mockTypesenseArticle = {
4+
authors: [
5+
{
6+
avatar: 'https://assets.stori.press/media/images/f3354bcf-a572-4fc0-8e3d-d19cbcfbc318.png',
7+
bio: '<p>Sid Test</p>',
8+
full_name: 'Sidd Chang',
9+
id: 242,
10+
location: 'T',
11+
slug: 'sidd-chang',
12+
socials: '[]',
13+
},
14+
],
15+
blurb: 'This is a mock article',
16+
cover:
17+
'{"url":"https:\\/\\/images.unsplash.com\\/photo-1704461539031-e7c2145e5fc4?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wyMzc2NzF8MHwxfGFsbHw5fHx8fHx8Mnx8MTcwNDc1ODc2Nnw&ixlib=rb-4.0.3&q=80&w=1080","alt":null,"caption":"<p>Photo by <a href=\\"https:\\/\\/unsplash.com\\/@kz29?utm_source=Storipress&utm_medium=referral&utm_campaign=api-credit?utm_source=storipress&utm_medium=referral&utm_campaign=api-credit\\">Keith Zhang<\\/a> \\/ <a href=\\"https:\\/\\/unsplash.com\\/?utm_source=storipress&utm_medium=referral&utm_campaign=api-credit\\">Unsplash<\\/a><\\/p>","crop":{"left":50,"top":50,"zoom":1,"width":0,"height":0,"realWidth":4032,"realHeight":3024,"key":""}}',
18+
desk: { id: 119, name: 'test', slug: 'test-32' },
19+
featured: false,
20+
id: '619',
21+
order: 400,
22+
pathnames: [
23+
'/posts/mock-article',
24+
'/posts/mock-article',
25+
'/posts/mock-article',
26+
'/posts/new-mock-article',
27+
'/posts/mock-article',
28+
],
29+
plan: 'free' as ArticlePlan,
30+
published_at: 1704757593,
31+
seo: '{"meta":{"title":"SEO Title Tag: Essential Tips for Effective Article Writing Article Writing","description":"Discover expert tips for boosting your website\'s visibility and driving traffic with our comprehensive SEO strategies guide. strategies guide."},"og":{"title":"","description":""},"ogImage":"","hasSlug":true}',
32+
slug: 'mock-article-test',
33+
tags: [{ id: 44, name: 'foo', slug: 'foo' }],
34+
title: 'Mock Article',
35+
updated_at: 1704758778,
36+
}
37+
38+
export const mockQueryArticle = {
39+
id: '619',
40+
blurb: '<p>This is a mock article</p>',
41+
published_at: '2024-01-08T23:46:33+00:00',
42+
updated_at: '2024-01-09T00:32:10+00:00',
43+
desk: {
44+
id: '119',
45+
name: 'test',
46+
slug: 'test-32',
47+
layout: null,
48+
desk: null,
49+
},
50+
slug: 'mock-article-test',
51+
title: '<p>Mock Article</p>',
52+
featured: false,
53+
cover:
54+
'{"url":"https:\\/\\/images.unsplash.com\\/photo-1704461539031-e7c2145e5fc4?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wyMzc2NzF8MHwxfGFsbHw5fHx8fHx8Mnx8MTcwNDc1ODc2Nnw&ixlib=rb-4.0.3&q=80&w=1080","alt":null,"caption":"<p>Photo by <a href=\\"https:\\/\\/unsplash.com\\/@kz29?utm_source=Storipress&utm_medium=referral&utm_campaign=api-credit?utm_source=storipress&utm_medium=referral&utm_campaign=api-credit\\">Keith Zhang<\\/a> \\/ <a href=\\"https:\\/\\/unsplash.com\\/?utm_source=storipress&utm_medium=referral&utm_campaign=api-credit\\">Unsplash<\\/a><\\/p>","crop":{"left":50,"top":50,"zoom":1,"width":0,"height":0,"realWidth":4032,"realHeight":3024,"key":""}}',
55+
seo: '{"meta":{"title":"SEO Title Tag: Essential Tips for Effective Article Writing Article Writing","description":"Discover expert tips for boosting your website\'s visibility and driving traffic with our comprehensive SEO strategies guide. strategies guide."},"og":{"title":"","description":""},"ogImage":"","hasSlug":true}',
56+
html: '<p>Mock Article Content</p>',
57+
plaintext: 'Mock Article Content',
58+
layout: null,
59+
tags: [
60+
{
61+
id: '44',
62+
slug: 'foo',
63+
name: 'foo',
64+
},
65+
],
66+
authors: [
67+
{
68+
id: '242',
69+
bio: '<p>Sid Test</p>',
70+
slug: 'sidd-chang',
71+
socials: '[]',
72+
avatar: 'https://assets.stori.press/media/images/f3354bcf-a572-4fc0-8e3d-d19cbcfbc318.png',
73+
email: 'sid+0705@storipress.com',
74+
location: 'T',
75+
first_name: 'Sidd',
76+
last_name: 'Chang',
77+
full_name: 'Sidd Chang',
78+
},
79+
],
80+
shadow_authors: null,
81+
plan: 'free' as ArticlePlan,
82+
metafields: [
83+
{
84+
id: '76',
85+
key: 'layoutid',
86+
type: 'text',
87+
values: [],
88+
group: {
89+
id: '70',
90+
key: '__layoutmeta',
91+
type: 'articleMetafield',
92+
},
93+
},
94+
{
95+
id: '100',
96+
key: 'test',
97+
type: 'text',
98+
values: [],
99+
group: {
100+
id: '81',
101+
key: 'test',
102+
type: 'articleMetafield',
103+
},
104+
},
105+
{
106+
id: '104',
107+
key: 'color',
108+
type: 'color',
109+
values: [],
110+
group: {
111+
id: '82',
112+
key: 'webflow',
113+
type: 'articleMetafield',
114+
},
115+
},
116+
{
117+
id: '103',
118+
key: 'thumbnail-image',
119+
type: 'file',
120+
values: [],
121+
group: {
122+
id: '82',
123+
key: 'webflow',
124+
type: 'articleMetafield',
125+
},
126+
},
127+
],
128+
relevances: [
129+
{
130+
id: '21',
131+
title: 'When an editor thinks an article is',
132+
},
133+
{
134+
id: '20',
135+
title: 'When a writer wants an editor to review their work, it goes here',
136+
},
137+
{
138+
id: '24',
139+
title:
140+
"Chris' First Article Chris' First ArticleChris' First ArticleChris' First ArticleChris' First ArticleChris' First Article",
141+
},
142+
{
143+
id: '43',
144+
title: '<p>&lt;c&gt;12345&lt;/c&gt;</p>',
145+
},
146+
{
147+
id: '596',
148+
title: '<p>New Article 2</p>',
149+
},
150+
{
151+
id: '597',
152+
title: '<p>New article 3</p>',
153+
},
154+
{
155+
id: '598',
156+
title: '<p>New article 4</p>',
157+
},
158+
],
159+
content_blocks: [],
160+
}

0 commit comments

Comments
 (0)