UNPKG

874 BJavaScriptView Raw
1const snapshot = require('.')
2
3/* global describe, it */
4describe('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
20it('compares objects', () => {
21 const o = {
22 inner: {
23 a: 10,
24 b: 20
25 },
26 foo: 'foo'
27 }
28 snapshot(o)
29})
30
31it('strips functions', () => {
32 const {strip} = require('./utils')
33 const o = {
34 fn: () => {},
35 foo: 'foo'
36 }
37 snapshot(strip(o))
38})
39
40it('removes functions', () => {
41 const o = {
42 fn: () => {},
43 foo: 'foo'
44 }
45 // internally, o.fn will be stripped
46 // before comparing
47 snapshot(o)
48})
49
50it('should not store undefined value', () => {
51 let value = 42
52 snapshot(value)
53})
54
55// Jest mock "test"
56const test = it
57test('jest test', () => {
58 snapshot('jest value')
59})