-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.js
37 lines (34 loc) · 890 Bytes
/
index.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
import expect from 'expect';
import collapse from 'collapse-white-space';
import reactElementToJSXString from 'react-element-to-jsx-string';
const api = {
toEqualJSX(ReactElement) {
return expect(
reactElementToJSXString(this.actual)
).toEqual(
reactElementToJSXString(ReactElement)
);
},
toNotEqualJSX(ReactElement) {
return expect(
reactElementToJSXString(this.actual)
).toNotEqual(
reactElementToJSXString(ReactElement)
);
},
toIncludeJSX(ReactElement) {
return expect(
collapse(reactElementToJSXString(this.actual))
).toInclude(
collapse(reactElementToJSXString(ReactElement))
);
},
toNotIncludeJSX(ReactElement) {
return expect(
collapse(reactElementToJSXString(this.actual))
).toExclude(
collapse(reactElementToJSXString(ReactElement))
);
},
};
export default api;