@@ -25,6 +25,9 @@ test('spyOn', () => {
25
25
jest.spyOn();
26
26
spyOn(stuff);
27
27
jest.spyOn().mockImplementation();
28
+ jest.spyOn(stuff).and.resolveTo('lmao');
29
+ jest.spyOn(stuff).and.rejectWith('oh no');
30
+ const fetchSpy = spyOn(window, 'fetch').and.resolveTo({json: {}});
28
31
` ,
29
32
`
30
33
jest.spyOn().mockReturnValue();
@@ -36,6 +39,9 @@ test('spyOn', () => {
36
39
jest.spyOn();
37
40
jest.spyOn(stuff).mockImplementation(() => {});
38
41
jest.spyOn().mockImplementation();
42
+ jest.spyOn(stuff).mockResolvedValue('lmao');
43
+ jest.spyOn(stuff).mockRejectedValue('oh no');
44
+ const fetchSpy = jest.spyOn(window, 'fetch').mockResolvedValue({json: {}});
39
45
`
40
46
)
41
47
} )
@@ -49,6 +55,9 @@ test('jasmine.createSpy', () => {
49
55
jasmine.createSpy().and.callFake(arg => arg);
50
56
jasmine.createSpy().and.returnValue('lmao');
51
57
const spy2 = jasmine.createSpy().and.returnValue('lmao');
58
+ jasmine.createSpy().and.resolveTo('lmao');
59
+ jasmine.createSpy().and.rejectWith('oh no');
60
+ const spy3 = jasmine.createSpy().and.resolveTo('lmao');
52
61
` ,
53
62
`
54
63
jest.fn();
@@ -57,8 +66,14 @@ test('jasmine.createSpy', () => {
57
66
jest.fn(arg => arg);
58
67
jest.fn(() => 'lmao');
59
68
const spy2 = jest.fn(() => 'lmao');
69
+ jest.fn().mockResolvedValue('lmao');
70
+ jest.fn().mockRejectedValue('oh no');
71
+ const spy3 = jest.fn().mockResolvedValue('lmao');
60
72
`
61
73
)
74
+
75
+ // Ensure we haven't missed any console warnings
76
+ expect ( consoleWarnings ) . toEqual ( [ ] )
62
77
} )
63
78
64
79
test ( 'not supported jasmine.createSpy().and.*' , ( ) => {
0 commit comments