docbrown/app/javascript/articles/__tests__/utilities/articleUtilities.js
Nick Taylor 5e677daac1
Homepage feed components (#6052)
* wip - <PodcastArticle /> component.

* Added filler user avatar for other article types.

* Added <LoadingArticle /> component.

* wip

* wip on <Article /> component.

* Added <Article /> component to barrel file.

* Deleted assets from dummy storybook assets folder.

* Updated podcast article story avatar.

* More work on <Article /> component.

* Refactoring Storybook stories.

* Refactored so main component is just the <Article /> component.

* Added a missing video article property.

* Some refactoring of <Article /> component.

* Added Storybook knobs addon.

* Now <Article /> component supports an isBookmarked prop.

* Fixed podcast Storybook story.

* Made the knobs Storybook addon the first tab

* Added more <Article /> Storybook stories.

* More <Article /> component tweaks.

* Added publish time to <Article /> component stories.

* Made the timeAgo function compatible with Preact.

* Added loading="lazy" attribute to <img /> in <Article /> component.

* Added <Article /> Storybook story for past published date.

* Fixed publish date for <Article /> story data.

* Scrapped random avatars.

* Added snapshots for <Article /> component.

* Added snapshots for <LoadingArticle /> component.

* Now test article entities are shared.

* Fixed some wording of Storybook stories.

* Breaking up Article.jsx to make codeclimate happy.

* Now <Article /> component receives icon props.

* Added knobs for <Article /> icon props.

* Added *.stories.jsx to codeclimate exclusion list.

* Added **/*.stories.jsx to codeclimate exclusion list.

* Alright now we have the good glob for excluding Storybook from codeclimate 😆

* Added org headline changes from low hanging fruit PR.

* Updated <Article /> snapshot for org headline.
2020-02-19 11:39:13 -06:00

285 lines
6.9 KiB
JavaScript

export const assetPath = relativeUrl => `/images/${relativeUrl}`;
export const article = {
id: 62407,
title: 'Unbranded Home Loan Account',
path: '/some-post/path',
type_of: '',
class_name: 'Article',
flare_tag: {
id: 35682,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 23289,
user: {
username: 'Emil99',
name: 'Stella Macejkovic',
profile_image_90: '/images/10.png',
},
published_at_int: 1582037964819,
published_timestamp: 'Tue, 18 Feb 2020 14:59:24 GMT',
readable_publish_date: 'February 18',
};
export const articleWithOrganization = {
id: 62407,
title: 'Unbranded Home Loan Account',
path: '/some-post/path',
type_of: '',
class_name: 'Article',
flare_tag: {
id: 35682,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 23289,
user: {
username: 'Emil99',
name: 'Stella Macejkovic',
profile_image_90: '/images/10.png',
},
published_at_int: 1582037964819,
published_timestamp: 'Tue, 18 Feb 2020 14:59:24 GMT',
readable_publish_date: 'February 18',
organization: {
id: 87120,
name: 'Web info-mediaries',
slug: 'bluetooth-Gorgeous-Wooden-Pants',
profile_image_90: '/images/30.png',
},
};
export const articleWithSnippetResult = {
id: 62407,
title: 'Unbranded Home Loan Account',
path: '/some-post/path',
type_of: '',
class_name: 'Article',
flare_tag: {
id: 35682,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 23289,
user: {
username: 'Emil99',
name: 'Stella Macejkovic',
profile_image_90: '/images/10.png',
},
published_at_int: 1582037964819,
published_timestamp: 'Tue, 18 Feb 2020 14:59:24 GMT',
readable_publish_date: 'February 18',
_snippetResult: {
body_text: {
matchLevel: 'full',
value:
'copying Rest withdrawal Handcrafted multi-state Pre-emptive e-markets feed overriding RSS Fantastic Plastic Gloves invoice productize systemic Monaco',
},
comments_blob: {
matchLevel: 'none',
value:
'virtual index Global mindshare Malagasy Ariary back up Handmade green Interactions violet bandwidth Chief e-commerce front-end neural',
},
},
};
export const articleWithReactions = {
id: 62407,
title: 'Unbranded Home Loan Account',
path: '/some-post/path',
type_of: '',
class_name: 'Article',
flare_tag: {
id: 35682,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 23289,
user: {
username: 'Emil99',
name: 'Stella Macejkovic',
profile_image_90: '/images/10.png',
},
published_at_int: 1582037964819,
published_timestamp: 'Tue, 18 Feb 2020 14:59:24 GMT',
readable_publish_date: 'February 18',
positive_reactions_count: 232,
};
export const articleWithComments = {
id: 62407,
title: 'Unbranded Home Loan Account',
path: '/some-post/path',
type_of: '',
class_name: 'Article',
flare_tag: {
id: 35682,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 23289,
user: {
username: 'Emil99',
name: 'Stella Macejkovic',
profile_image_90: '/images/10.png',
},
published_at_int: 1582037964819,
published_timestamp: 'Tue, 18 Feb 2020 14:59:24 GMT',
readable_publish_date: 'February 18',
positive_reactions_count: 428,
comments_count: 213,
};
export const articleWithReadingTimeGreaterThan1 = {
id: 62407,
title: 'Unbranded Home Loan Account',
path: '/some-post/path',
type_of: '',
class_name: 'Article',
flare_tag: {
id: 35682,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 23289,
user: {
username: 'Emil99',
name: 'Stella Macejkovic',
profile_image_90: '/images/10.png',
},
published_at_int: 1582037964819,
published_timestamp: 'Tue, 18 Feb 2020 14:59:24 GMT',
readable_publish_date: 'February 18',
reading_time: 8,
};
export const videoArticle = {
id: 49020,
title: 'monitor recontextualize',
path: '/some-post/path',
type_of: '',
class_name: 'Article',
flare_tag: {
id: 58676,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 27683,
user: {
username: 'Nova_Luettgen',
name: 'Henri Gibson',
profile_image_90: '/images/10.png',
},
published_at_int: 1582038662478,
published_timestamp: 'Tue, 18 Feb 2020 15:11:02 GMT',
readable_publish_date: 'February 18',
cloudinary_video_url: '/images/onboarding-background.png',
video_duration_in_minutes: 10,
};
export const podcastArticle = {
id: 49020,
title: 'monitor recontextualize',
path: '/some-post/path',
type_of: 'podcast_episodes',
class_name: 'Article',
flare_tag: {
id: 58676,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 27683,
user: {
username: 'Nova_Luettgen',
name: 'Henri Gibson',
profile_image_90: '/images/10.png',
},
published_at_int: 1582038662478,
published_timestamp: 'Tue, 18 Feb 2020 15:11:02 GMT',
readable_publish_date: 'February 18',
podcast: {
slug: 'monitor-recontextualize',
title: 'Rubber local',
image_url: '/images/16.png',
},
};
export const podcastEpisodeArticle = {
id: 49020,
title: 'monitor recontextualize',
path: '/some-post/path',
type_of: '',
class_name: 'PodcastEpisode',
flare_tag: {
id: 58676,
name: 'javascript',
hotness_score: 99,
points: 23,
bg_color_hex: '#000000',
text_color_hex: '#ffffff',
},
tag_list: ['javascript', 'ruby', 'go'],
cached_tag_list_array: [],
user_id: 27683,
user: {
username: 'Nova_Luettgen',
name: 'Henri Gibson',
profile_image_90: '/images/10.png',
},
published_at_int: 1582038662478,
published_timestamp: 'Tue, 18 Feb 2020 15:11:02 GMT',
readable_publish_date: 'February 18',
};
export const userArticle = {
id: 24692,
title: 'Phyllis Armstrong',
user_id: 7955,
class_name: 'User',
user: {
username: 'phyllis.armstrong',
name: 'Phyllis Armstrong',
profile_image_90: '/images/3.png',
},
};