Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: component testing #177

Merged
merged 28 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
993188d
wip: unit testing setup
WesselSmit Sep 3, 2024
73df224
feat: add unit-testing for i18n lib
WesselSmit Sep 4, 2024
9bd634e
fix: prevent console.warn from actually logging warnings in tests
WesselSmit Sep 6, 2024
891d53e
Start tests
luukbrauckmann Sep 11, 2024
4c39a4d
Added working test files
luukbrauckmann Sep 12, 2024
f9f3fad
Fixed Astro.site for now
luukbrauckmann Sep 12, 2024
ca03e22
Add more tests for embed block
luukbrauckmann Sep 16, 2024
65d9ce3
feature: Sitelinks Searchbox (#140)
luukbrauckmann Sep 15, 2024
30abb69
Feat/anchor slot trim (#173)
jurgenbelien Sep 15, 2024
ec23e91
Fix: Astro imports in typescript (#176)
luukbrauckmann Sep 15, 2024
9177eb1
Added tests for page partial block
luukbrauckmann Sep 16, 2024
26a3e35
Refactored test files and started on table tests
luukbrauckmann Sep 16, 2024
768af67
Added table tests
luukbrauckmann Sep 16, 2024
38e91b6
Added tests for TextBlock
luukbrauckmann Sep 16, 2024
34ad709
Add tests for TextImageBlock
luukbrauckmann Sep 16, 2024
28709e9
Some refactoring and adde VideoBlock tests
luukbrauckmann Sep 16, 2024
3f01879
Added VideoEmbedBlock tests
luukbrauckmann Sep 16, 2024
420cd42
feat/unit-testing (#169)
WesselSmit Sep 16, 2024
2304433
Refactored code and added Accordion component tests
luukbrauckmann Sep 17, 2024
38df5d3
Added accordion item tests
luukbrauckmann Sep 17, 2024
f9c6d2f
Refactor
luukbrauckmann Sep 17, 2024
56a72e7
Fixed tabs tests
luukbrauckmann Sep 20, 2024
9392d0b
Merge main
luukbrauckmann Sep 23, 2024
444f9bf
Improved ImageBlock test and removed LocaleSelector tests
luukbrauckmann Sep 23, 2024
5eb0f17
Improved test naming. Made the names more descriptive
luukbrauckmann Sep 23, 2024
8b3d04e
Resolved some all comments and reduced the teardownTimeout
luukbrauckmann Sep 23, 2024
37426da
New lockfile
luukbrauckmann Sep 24, 2024
24f5842
Removed console log & commented code
luukbrauckmann Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/plop/templates/block/Block.astro.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import type { {{ pascalCase name }}Fragment } from '@lib/types/datocms';

interface Props {
block: {{ pascalCase name }}Fragment
export interface Props {
block: {{ pascalCase name }}Fragment
}
const { block } = Astro.props;
---
Expand Down
17 changes: 17 additions & 0 deletions config/plop/templates/block/Block.test.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { renderToFragment } from '@lib/renderer';
import { describe, expect, test } from 'vitest';
import {{ pascalCase name }}, { type Props } from './{{ pascalCase name }}.astro';

describe('{{ pascalCase name }}', () => {
test('Block is rendered', async () => {
const fragment = await renderToFragment<Props>({{ pascalCase name }}, {
props: {
block: {}
}
});

expect(fragment).toBeTruthy();
});

// Add more tests here
});
14 changes: 14 additions & 0 deletions config/plop/templates/component/Component.test.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { renderToFragment } from '@lib/renderer';
import { describe, expect, test } from 'vitest';
import {{ pascalCase name }} from './{{ pascalCase name }}.astro';


describe('{{ pascalCase name }}', () => {
test('Component is rendered', async () => {
const fragment = await renderToFragment({{ pascalCase name }});

expect(fragment).toBeTruthy();
});

// Add more tests here
});
Loading
Loading