forked from nodejs/nodejs.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle.test.tsx
More file actions
37 lines (33 loc) · 947 Bytes
/
article.test.tsx
File metadata and controls
37 lines (33 loc) · 947 Bytes
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
import React from 'react';
import Article from '../../src/components/article';
import * as ShallowRenderer from 'react-test-renderer/shallow';
import {
createLearnPageData,
createLearnPageContext,
} from '../__fixtures__/page';
describe('Article component', () => {
it('renders correctly', () => {
const renderer = ShallowRenderer.createRenderer();
const learnPageData = createLearnPageData();
const learnPageContext = createLearnPageContext();
const {
doc: {
frontmatter: { title, description },
html,
fields: { authors },
},
} = learnPageData;
const { relativePath, next, previous } = learnPageContext;
renderer.render(
<Article
title={title}
html={html}
next={next}
previous={previous}
authors={authors}
relativePath={relativePath}
/>
);
expect(renderer.getRenderOutput()).toMatchSnapshot();
});
});