From d9bf6f0d69ecb4475c06c772ef6314e5a7ee0fe8 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 15 Apr 2022 16:32:55 +0200
Subject: chore: add a LinksListWidget component

---
 .../organisms/widgets/links-list-widget.test.tsx   | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 src/components/organisms/widgets/links-list-widget.test.tsx

(limited to 'src/components/organisms/widgets/links-list-widget.test.tsx')

diff --git a/src/components/organisms/widgets/links-list-widget.test.tsx b/src/components/organisms/widgets/links-list-widget.test.tsx
new file mode 100644
index 0000000..a8d6a35
--- /dev/null
+++ b/src/components/organisms/widgets/links-list-widget.test.tsx
@@ -0,0 +1,32 @@
+import { render, screen } from '@test-utils';
+import LinksListWidget from './links-list-widget';
+
+const title = 'Voluptatem minus autem';
+
+const items = [
+  { name: 'Item 1', url: '/item-1' },
+  { name: 'Item 2', url: '/item-2' },
+  { name: 'Item 3', url: '/item-3' },
+];
+
+describe('LinksListWidget', () => {
+  it('renders a widget title', () => {
+    render(<LinksListWidget items={items} title={title} level={2} />);
+    expect(
+      screen.getByRole('heading', { level: 2, name: new RegExp(title, 'i') })
+    ).toBeInTheDocument();
+  });
+
+  it('renders the correct number of items', () => {
+    render(<LinksListWidget items={items} title={title} level={2} />);
+    expect(screen.getAllByRole('listitem')).toHaveLength(items.length);
+  });
+
+  it('renders some links', () => {
+    render(<LinksListWidget items={items} title={title} level={2} />);
+    expect(screen.getByRole('link', { name: items[0].name })).toHaveAttribute(
+      'href',
+      items[0].url
+    );
+  });
+});
-- 
cgit v1.2.3

