diff options
Diffstat (limited to 'src/components/molecules/colophon/colophon.test.tsx')
| -rw-r--r-- | src/components/molecules/colophon/colophon.test.tsx | 37 |
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); + }); +}); |
