Skip to content

Commit

Permalink
test(Article): add partial Article snapshot testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Aug 6, 2021
1 parent 42747cf commit e3eb45b
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/components/Article/Article.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ import Article from './Article';
describe('Article', () => {
const commentUrl = 'https://example.com';
const socialUrl = 'https://example.com';
const post = {
const basePost = {
slug: '/reduxBasicNotes/',
timeToRead: 8,
excerpt: 'Redux Basic Notes Basic Concepts',
toc: 'Redux Basic Notes ToC',
html: '<h1>Redux Basic Notes</h1>',
};
const post = {
...basePost,
title: 'Redux Basic Notes',
subtitle: 'Be a Stupid Learner',
author: 'Sabertaz',
date: '2018-08-08T00:00:00.000Z',
tags: [
'Redux',
'React',
'JavaScript',
'Frontend Development',
'Web Development',
],
date: '2018-08-08T00:00:00.000Z',
timeToRead: 8,
excerpt: 'Redux Basic Notes Basic Concepts',
toc: 'Redux Basic Notes ToC',
html: '<h1>Redux Basic Notes</h1>',
prevPost: {
slug: '/javascriptBasicNotes/',
title: 'JavaScript Basic Notes',
Expand All @@ -40,4 +43,17 @@ describe('Article', () => {
.toJSON();
expect(tree).toMatchSnapshot();
});

test('should render correctly without partial data (snapshot)', () => {
const tree = renderer
.create(
<Article
post={basePost}
commentUrl={commentUrl}
socialUrl={socialUrl}
/>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
});

0 comments on commit e3eb45b

Please sign in to comment.