-
Notifications
You must be signed in to change notification settings - Fork 64
/
mount.test.js
47 lines (36 loc) · 1.44 KB
/
mount.test.js
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
43
44
45
46
47
/* eslint-env jest */
import React from 'react';
import { mount } from 'enzyme';
import { mountToJson } from '../src';
import { BasicPure } from './fixtures/pure-function';
import { BasicClass, ClassWithPure, ClassWithDirectPure, ClassWithDirectComponent } from './fixtures/class';
it('converts basic pure mount', () => {
const mounted = mount(
<BasicPure className="pure"><strong>Hello!</strong></BasicPure>
);
expect(mountToJson(mounted)).toMatchSnapshot();
});
it('converts basic class mount', () => {
const mounted = mount(
<BasicClass className="class"><strong>Hello!</strong></BasicClass>
);
expect(mountToJson(mounted)).toMatchSnapshot();
});
it('converts a class mount with a pure function in it', () => {
const mounted = mount(
<ClassWithPure className="class"><strong>Hello!</strong></ClassWithPure>
);
expect(mountToJson(mounted)).toMatchSnapshot();
});
it('converts a class mount with a pure function in it as a direct child', () => {
const mounted = mount(
<ClassWithDirectPure className="class"><strong>Hello!</strong></ClassWithDirectPure>
);
expect(mountToJson(mounted)).toMatchSnapshot();
});
it('converts a class mount with a class component in it as a direct child', () => {
const mounted = mount(
<ClassWithDirectComponent className="class"><strong>Hello!</strong></ClassWithDirectComponent>
);
expect(mountToJson(mounted)).toMatchSnapshot();
});