forked from zoltantothcom/Design-Patterns-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTitle.test.js
More file actions
35 lines (29 loc) · 955 Bytes
/
Title.test.js
File metadata and controls
35 lines (29 loc) · 955 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
import React from 'react';
import renderer from 'react-test-renderer';
import { shallow } from 'enzyme';
import 'jest-styled-components';
import Title from '../../src/components/Title';
import { renderWithLightTheme } from '../helpers';
import { renderWithDarkTheme } from '../helpers';
describe('<Title /> component', () => {
let titleEl = <Title />;
let title;
beforeEach(() => {
title = shallow(titleEl);
});
it('renders without crashing', () => {
expect(title).toBeTruthy();
});
it('has styled-component rendered classes', () => {
const tree = renderer.create(titleEl).toJSON();
expect(tree.props.className).toBeDefined();
});
it('renders with a LIGHT theme', () => {
const tree = renderWithLightTheme(titleEl).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders with a DARK theme', () => {
const tree = renderWithDarkTheme(titleEl).toJSON();
expect(tree).toMatchSnapshot();
});
});