Skip to content

Commit 1d7734e

Browse files
fix: WIP on spies
A push for @sniperadmin to help on with spies for plain JavaScript files
1 parent 2cf4d7c commit 1d7734e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Diff for: tests/unit/remote/peer-fetch.spec.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import PeerFetch from '../../../src/remote/peer-fetch.js'
2+
3+
beforeAll(() => {
4+
jest.spyOn(PeerFetch.prototype, '_drawNewTicket').mockImplementation(() => '12');
5+
});
6+
7+
afterAll(() => {
8+
jest.restoreAllMocks();
9+
});
10+
11+
test('Modify class', () => {
12+
let peer = new PeerFetch();
13+
expect(peer._drawNewTicket()).toBe("12");
14+
});
File renamed without changes.

0 commit comments

Comments
 (0)