1 | const snapshot = require('.')
|
2 |
|
3 |
|
4 | describe('the number', () => {
|
5 | const number = 42
|
6 |
|
7 | it('is 42', () => {
|
8 | snapshot(42)
|
9 | })
|
10 |
|
11 | it('should be 42', () => {
|
12 | snapshot(number)
|
13 | })
|
14 |
|
15 | it('should be 80', () => {
|
16 | snapshot(80)
|
17 | })
|
18 | })
|
19 |
|
20 | it('compares objects', () => {
|
21 | const o = {
|
22 | inner: {
|
23 | a: 10,
|
24 | b: 20
|
25 | },
|
26 | foo: 'foo'
|
27 | }
|
28 | snapshot(o)
|
29 | })
|
30 |
|
31 | it('strips functions', () => {
|
32 | const {strip} = require('./utils')
|
33 | const o = {
|
34 | fn: () => {},
|
35 | foo: 'foo'
|
36 | }
|
37 | snapshot(strip(o))
|
38 | })
|
39 |
|
40 | it('removes functions', () => {
|
41 | const o = {
|
42 | fn: () => {},
|
43 | foo: 'foo'
|
44 | }
|
45 |
|
46 |
|
47 | snapshot(o)
|
48 | })
|
49 |
|
50 | it('should not store undefined value', () => {
|
51 | let value = 42
|
52 | snapshot(value)
|
53 | })
|
54 |
|
55 |
|
56 | const test = it
|
57 | test('jest test', () => {
|
58 | snapshot('jest value')
|
59 | })
|