-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
57 lines (51 loc) · 1.47 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* global weknowhow, unexpectedSnapshot */
// eslint-disable-next-line no-var
var expect = weknowhow.expect.clone().use(unexpectedSnapshot);
describe('unexpected-snapshot', function () {
describe('to equal snapshot', function () {
it('should succeed', function () {
expect('abc', 'to equal snapshot', 'abc');
});
it('should fail with a diff', function () {
expect(
function () {
expect('abc', 'to equal snapshot', 'def');
},
'to throw',
"expected 'abc' to equal snapshot 'def'\n" +
'\n' +
'-abc\n' +
'+def\n' +
'\n' +
'Rerun the tests with UNEXPECTED_SNAPSHOT=yes in Node to update the snapshots'
);
});
});
describe('to inspect as snapshot', function () {
function Person(name) {
this.name = name;
}
it('should succeed', function () {
expect(
new Person('Eigil'),
'to inspect as snapshot',
"Person({ name: 'Eigil' })"
);
});
it('should fail with a diff', function () {
expect(
function () {
expect(
new Person('Eigil'),
'to equal snapshot',
"Person({ name: 'Preben' })"
);
},
'to throw',
"expected Person({ name: 'Eigil' }) to equal snapshot 'Person({ name: \\'Preben\\' })'\n" +
'\n' +
'Rerun the tests with UNEXPECTED_SNAPSHOT=yes in Node to update the snapshots'
);
});
});
});