From 98044be08600daf6bd7c7e1a4adada319dbcbbaf Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 20 Oct 2023 15:23:47 +0200 Subject: feat(components): add a Colophon component --- .../molecules/colophon/colophon.test.tsx | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/components/molecules/colophon/colophon.test.tsx (limited to 'src/components/molecules/colophon/colophon.test.tsx') 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(); + + expect(rtlScreen.getByRole('listitem')).toHaveTextContent(copyright); + }); + + it('can render a license', () => { + const copyright = 'ea aliquam porro'; + const license = 'ea facere non'; + + render(); + + 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(); + + // The links + the copyright + expect(rtlScreen.getAllByRole('listitem')).toHaveLength(links.length + 1); + }); +}); -- cgit v1.2.3