aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/colophon/colophon.test.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-20 15:23:47 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit98044be08600daf6bd7c7e1a4adada319dbcbbaf (patch)
tree73b5509d2061a984a8f1e22ff776fdcdb764ecce /src/components/molecules/colophon/colophon.test.tsx
parent9492414d4ae94045eff4e06f636529bc0e71cb06 (diff)
feat(components): add a Colophon component
Diffstat (limited to 'src/components/molecules/colophon/colophon.test.tsx')
-rw-r--r--src/components/molecules/colophon/colophon.test.tsx37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/components/molecules/colophon/colophon.test.tsx b/src/components/molecules/colophon/colophon.test.tsx
new file mode 100644
index 0000000..37b2ef4
--- /dev/null
+++ b/src/components/molecules/colophon/colophon.test.tsx
@@ -0,0 +1,37 @@
+import { describe, expect, it } from '@jest/globals';
+import { render, screen as rtlScreen } from '@testing-library/react';
+import { Colophon, type ColophonLink } from './colophon';
+
+describe('Colophon', () => {
+ it('renders a copyright', () => {
+ const copyright = 'ea aliquam porro';
+
+ render(<Colophon copyright={copyright} />);
+
+ expect(rtlScreen.getByRole('listitem')).toHaveTextContent(copyright);
+ });
+
+ it('can render a license', () => {
+ const copyright = 'ea aliquam porro';
+ const license = 'ea facere non';
+
+ render(<Colophon copyright={copyright} license={license} />);
+
+ const items = rtlScreen.getAllByRole('listitem');
+
+ expect(items[items.length - 1]).toHaveTextContent(license);
+ });
+
+ it('can render some links', () => {
+ const copyright = 'ea aliquam porro';
+ const links: ColophonLink[] = [
+ { href: '#blanditiis', id: 'perferendis', label: 'quis' },
+ { href: '#mollitia', id: 'sint', label: 'ducimus' },
+ ];
+
+ render(<Colophon copyright={copyright} links={links} />);
+
+ // The links + the copyright
+ expect(rtlScreen.getAllByRole('listitem')).toHaveLength(links.length + 1);
+ });
+});