From 4a6f3dbde9adaa671e622215654a1dd9b329610d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 12 Apr 2022 16:28:25 +0200
Subject: chore: add a Nav component

---
 src/components/molecules/nav/nav.test.tsx | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 src/components/molecules/nav/nav.test.tsx

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

diff --git a/src/components/molecules/nav/nav.test.tsx b/src/components/molecules/nav/nav.test.tsx
new file mode 100644
index 0000000..183ca0b
--- /dev/null
+++ b/src/components/molecules/nav/nav.test.tsx
@@ -0,0 +1,28 @@
+import Envelop from '@components/atoms/icons/envelop';
+import Home from '@components/atoms/icons/home';
+import { render, screen } from '@test-utils';
+import Nav, { type NavItem } from './nav';
+
+const navItems: NavItem[] = [
+  { id: 'homeLink', href: '/', label: 'Home', logo: <Home /> },
+  { id: 'contactLink', href: '/contact', label: 'Contact', logo: <Envelop /> },
+];
+
+describe('Nav', () => {
+  it('renders a main navigation', () => {
+    render(<Nav kind="main" items={navItems} />);
+    expect(screen.getByRole('navigation')).toHaveClass('nav--main');
+  });
+
+  it('renders a footer navigation', () => {
+    render(<Nav kind="footer" items={navItems} />);
+    expect(screen.getByRole('navigation')).toHaveClass('nav--footer');
+  });
+
+  it('renders navigation links', () => {
+    render(<Nav kind="main" items={navItems} />);
+    expect(
+      screen.getByRole('link', { name: navItems[0].label })
+    ).toHaveAttribute('href', navItems[0].href);
+  });
+});
-- 
cgit v1.2.3

