|
1 | 1 | import {escape} from 'node:querystring';
|
2 | 2 |
|
| 3 | +import nock from 'nock'; |
| 4 | +import quibble from 'quibble'; |
| 5 | +import sinon from 'sinon'; |
3 | 6 | import test from 'ava';
|
4 |
| -import {cleanAll} from 'nock'; |
5 |
| -import {stub} from 'sinon'; |
6 |
| -import proxyquire from 'proxyquire'; |
7 | 7 |
|
8 | 8 | import {ISSUE_ID} from '../lib/definitions/constants.js';
|
9 | 9 | import findSRIssues from '../lib/find-sr-issues.js';
|
10 | 10 | import {authenticate} from './helpers/mock-github.js';
|
11 |
| -import rateLimit from './helpers/rate-limit.js'; |
| 11 | +import * as RATE_LIMIT_MOCK from './helpers/rate-limit.js'; |
| 12 | + |
| 13 | +// mock rate limit imported via lib/get-client.js |
| 14 | +await quibble.esm('../lib/definitions/rate-limit.js', RATE_LIMIT_MOCK) |
| 15 | +const getClient = (await import('../lib/get-client.js')).default |
12 | 16 |
|
13 | 17 | const githubToken = 'github_token';
|
14 |
| -const client = proxyquire('../lib/get-client', {'./definitions/rate-limit': rateLimit})({githubToken}); |
| 18 | +const client =getClient({githubToken}); |
15 | 19 |
|
16 | 20 | test.beforeEach((t) => {
|
17 | 21 | // Mock logger
|
18 |
| - t.context.log = stub(); |
19 |
| - t.context.error = stub(); |
| 22 | + t.context.log = sinon.stub(); |
| 23 | + t.context.error = sinon.stub(); |
20 | 24 | t.context.logger = {log: t.context.log, error: t.context.error};
|
21 | 25 | });
|
22 | 26 |
|
23 | 27 | test.afterEach.always(() => {
|
24 | 28 | // Clear nock
|
25 |
| - cleanAll(); |
| 29 | + nock.cleanAll(); |
26 | 30 | });
|
27 | 31 |
|
28 | 32 | test.serial('Filter out issues without ID', async (t) => {
|
|
0 commit comments