-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.test.tsx
42 lines (34 loc) · 900 Bytes
/
index.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { render } from '@testing-library/react';
import { CategoriesSelector } from './index.tsx';
const mockCategories = [
{
slug: 'slug1',
category: 'category1',
},
{
slug: 'slug2',
category: 'category2',
},
];
const mockCurrentCategories = ['slug1'];
describe('CategoriesSelector', () => {
it('should render with an active category', t => {
const { container, unmount } = render(
<CategoriesSelector
categories={mockCategories}
currentCategories={mockCurrentCategories}
/>
);
t.assert.snapshot(container.innerHTML);
unmount();
});
it('should render with no active category', t => {
const { container, unmount } = render(
<CategoriesSelector categories={mockCategories} currentCategories={[]} />
);
t.assert.snapshot(container.innerHTML);
unmount();
});
});