From 73f94705dc583e968114e5a09e85979448f3412b Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 7 Jun 2022 16:02:21 +0200
Subject: chore(cards): use post title as link label

---
 src/components/molecules/layout/card.test.tsx | 33 ++++++++-------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

(limited to 'src/components/molecules/layout/card.test.tsx')

diff --git a/src/components/molecules/layout/card.test.tsx b/src/components/molecules/layout/card.test.tsx
index d481f6c..1023aeb 100644
--- a/src/components/molecules/layout/card.test.tsx
+++ b/src/components/molecules/layout/card.test.tsx
@@ -1,49 +1,36 @@
 import { render, screen } from '@tests/utils';
 import Card from './card';
-
-const cover = {
-  alt: 'A picture',
-  height: 480,
-  src: 'http://placeimg.com/640/480',
-  width: 640,
-};
-
-const meta = {
-  author: 'Possimus',
-  thematics: ['Autem', 'Eos'],
-};
-
-const tagline = 'Ut rerum incidunt';
-
-const title = 'Alias qui porro';
-
-const url = '/an-existing-url';
+import { cover, id, meta, tagline, title, url } from './card.fixture';
 
 describe('Card', () => {
   it('renders a title wrapped in h2 element', () => {
-    render(<Card title={title} titleLevel={2} url={url} />);
+    render(<Card id={id} title={title} titleLevel={2} url={url} />);
     expect(
       screen.getByRole('heading', { level: 2, name: title })
     ).toBeInTheDocument();
   });
 
   it('renders a link to another page', () => {
-    render(<Card title={title} titleLevel={2} url={url} />);
+    render(<Card id={id} title={title} titleLevel={2} url={url} />);
     expect(screen.getByRole('link')).toHaveAttribute('href', url);
   });
 
   it('renders a cover', () => {
-    render(<Card title={title} titleLevel={2} url={url} cover={cover} />);
+    render(
+      <Card id={id} title={title} titleLevel={2} url={url} cover={cover} />
+    );
     expect(screen.getByRole('img', { name: cover.alt })).toBeInTheDocument();
   });
 
   it('renders a tagline', () => {
-    render(<Card title={title} titleLevel={2} url={url} tagline={tagline} />);
+    render(
+      <Card id={id} title={title} titleLevel={2} url={url} tagline={tagline} />
+    );
     expect(screen.getByText(tagline)).toBeInTheDocument();
   });
 
   it('renders some meta', () => {
-    render(<Card title={title} titleLevel={2} url={url} meta={meta} />);
+    render(<Card id={id} title={title} titleLevel={2} url={url} meta={meta} />);
     expect(screen.getByText(meta.author)).toBeInTheDocument();
   });
 });
-- 
cgit v1.2.3

