aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/layout/posts-list.test.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-09 18:19:38 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-09 19:41:02 +0200
commit0d59a6d2995b4119865271ed1908ede0bb96497c (patch)
tree67688e41b7aa253aa58cc08aa360431b07382f9d /src/components/organisms/layout/posts-list.test.tsx
parent339c6957fe92c4ec1809159f09c55201d3794c18 (diff)
refactor: rewrite DescriptionList and Meta components
The meta can have different layout. The previous implementation was not enough to easily change the layout. Also, I prefer to restrict the meta types and it prevents me to repeat myself for the labels.
Diffstat (limited to 'src/components/organisms/layout/posts-list.test.tsx')
-rw-r--r--src/components/organisms/layout/posts-list.test.tsx76
1 files changed, 29 insertions, 47 deletions
diff --git a/src/components/organisms/layout/posts-list.test.tsx b/src/components/organisms/layout/posts-list.test.tsx
index aa6dffa..98af1c3 100644
--- a/src/components/organisms/layout/posts-list.test.tsx
+++ b/src/components/organisms/layout/posts-list.test.tsx
@@ -1,29 +1,23 @@
import { render, screen } from '@test-utils';
-import PostsList from './posts-list';
+import PostsList, { Post } from './posts-list';
-const posts = [
+const posts: Post[] = [
{
excerpt:
'Esse et voluptas sapiente modi impedit unde et. Ducimus nulla ea impedit sit placeat nihil assumenda. Rem est fugiat amet quo hic. Corrupti fuga quod animi autem dolorem ullam corrupti vel aut.',
id: 'post-1',
meta: {
- publication: {
- name: 'Published on:',
- value: '2022-02-26T00:42:02',
- },
- readingTime: { name: 'Reading time:', value: '5 minutes' },
- categories: {
- name: 'Categories:',
- value: [
- <a key="cat-1" href="#">
- Cat 1
- </a>,
- <a key="cat-2" href="#">
- Cat 2
- </a>,
- ],
- },
- comments: { name: 'Comments:', value: '1 comment' },
+ publication: { date: '2022-02-26' },
+ readingTime: '5 minutes',
+ thematics: [
+ <a key="cat-1" href="#">
+ Cat 1
+ </a>,
+ <a key="cat-2" href="#">
+ Cat 2
+ </a>,
+ ],
+ commentsCount: '1 comment',
},
title: 'Ratione velit fuga',
url: '#',
@@ -39,20 +33,14 @@ const posts = [
'Illum quae asperiores quod aut necessitatibus itaque excepturi voluptas. Incidunt exercitationem ullam saepe alias consequatur sed. Quam veniam quaerat voluptatum earum quia quisquam fugiat sed perspiciatis. Et velit saepe est recusandae facilis eos eum ipsum.',
id: 'post-2',
meta: {
- publication: {
- name: 'Published on:',
- value: '2022-02-20T10:40:00',
- },
- readingTime: { name: 'Reading time:', value: '8 minutes' },
- categories: {
- name: 'Categories:',
- value: [
- <a key="cat-2" href="#">
- Cat 2
- </a>,
- ],
- },
- comments: { name: 'Comments:', value: '0 comments' },
+ publication: { date: '2022-02-20' },
+ readingTime: '8 minutes',
+ thematics: [
+ <a key="cat-2" href="#">
+ Cat 2
+ </a>,
+ ],
+ commentsCount: '0 comments',
},
title: 'Debitis laudantium laudantium',
url: '#',
@@ -62,20 +50,14 @@ const posts = [
'Sunt aperiam ut rem impedit dolor id sit. Reprehenderit ipsum iusto fugiat. Quaerat laboriosam magnam facilis. Totam sint aliquam voluptatem in quis laborum sunt eum. Enim aut debitis officiis porro iure quia nihil voluptas ipsum. Praesentium quis necessitatibus cumque quia qui velit quos dolorem.',
id: 'post-3',
meta: {
- publication: {
- name: 'Published on:',
- value: '2021-12-20T15:12:02',
- },
- readingTime: { name: 'Reading time:', value: '3 minutes' },
- categories: {
- name: 'Categories:',
- value: [
- <a key="cat-1" href="#">
- Cat 1
- </a>,
- ],
- },
- comments: { name: 'Comments:', value: '3 comments' },
+ publication: { date: '2021-12-20' },
+ readingTime: '3 minutes',
+ thematics: [
+ <a key="cat-1" href="#">
+ Cat 1
+ </a>,
+ ],
+ commentsCount: '3 comments',
},
title: 'Quaerat ut corporis',
url: '#',