-
Notifications
You must be signed in to change notification settings - Fork 2
/
dummy.test.js
48 lines (37 loc) · 886 Bytes
/
dummy.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
48
import React from 'react';
import ReactDOM from 'react-dom';
import deepFreeze from 'deep-freeze';
function add(a, b) {
if (typeof a === 'number' && typeof b === 'number') {
return a + b;
} else {
return 0;
}
}
const dummyState = { a: 0 };
describe('Dummy', () => {
beforeAll(() => {
const fixture = '<div id="dom-test"></div>';
if (window) {
document.body.innerHTML = fixture;
}
// test immutability
deepFreeze(dummyState);
});
it('does nothing', () => {
expect(1).toEqual(1);
});
it('also does nothing', () => {
expect(0).toBeFalsy;
});
it('adds numbers', () => {
expect(add(2, 3)).toEqual(5);
});
it('handles wrong type', () => {
expect(add('a', 3)).toEqual(0);
});
it('should have DOM', () => {
expect(document.getElementById('dom-test')).toBeDefined;
});
it('should be skipped');
});