From: Ruben Beltran del Rio Date: Mon, 19 Apr 2021 19:04:59 +0000 (+0200) Subject: Add tests for first batch of components X-Git-Url: https://git.r.bdr.sh/rbdr/forum/commitdiff_plain/879fa389c2592760def75177eefbd3193e1845c9?ds=inline;hp=77182aa8d0fa96b594d1c2582a168e2ebe15964d Add tests for first batch of components - Glyph - Forum List - Error Block - Post --- diff --git a/jest.config.json b/jest.config.json index 4907484..46f62f4 100644 --- a/jest.config.json +++ b/jest.config.json @@ -7,5 +7,8 @@ "^\\$lib(.*)$": "/src/lib$1", "^\\$app(.*)$": [".svelte/dev/runtime/app/*", ".svelte/build/runtime/app/*"] }, - "moduleFileExtensions": ["js", "svelte"] + "moduleFileExtensions": ["js", "svelte"], + "moduleNameMapper": { + "^\\$(.*)$": "/src$1" + } } diff --git a/src/components/error_block/error_block.test.js b/src/components/error_block/error_block.test.js new file mode 100644 index 0000000..bd2fe7a --- /dev/null +++ b/src/components/error_block/error_block.test.js @@ -0,0 +1,20 @@ +import '@testing-library/jest-dom/extend-expect'; + +import { render } from '@testing-library/svelte'; +import '$/config/i18n'; + +import ErrorBlock from './error_block.svelte'; + +describe('Glyph component', () => { + + test('Should act as an image', () => { + + const results = render(ErrorBlock, { props: { + message: 'An error has, sadly, destroyed everything.' + } }); + + expect(results.getByText('An error has, sadly, destroyed everything.')) + .toBeVisible(); + }); +}); + diff --git a/src/components/forum_list/forum_list.svelte b/src/components/forum_list/forum_list.svelte index 7bfb7b2..a33358c 100644 --- a/src/components/forum_list/forum_list.svelte +++ b/src/components/forum_list/forum_list.svelte @@ -1,36 +1,22 @@ - + diff --git a/src/routes/$layout.svelte b/src/routes/$layout.svelte index 49ceb49..8fd2ae0 100644 --- a/src/routes/$layout.svelte +++ b/src/routes/$layout.svelte @@ -1,6 +1,12 @@