Skip to content

Commit 0fbc003

Browse files
committed
test: adapt findIssues test
1 parent e2ee5e6 commit 0fbc003

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/find-sr-issue.test.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
import {escape} from 'node:querystring';
22

3+
import nock from 'nock';
4+
import quibble from 'quibble';
5+
import sinon from 'sinon';
36
import test from 'ava';
4-
import {cleanAll} from 'nock';
5-
import {stub} from 'sinon';
6-
import proxyquire from 'proxyquire';
77

88
import {ISSUE_ID} from '../lib/definitions/constants.js';
99
import findSRIssues from '../lib/find-sr-issues.js';
1010
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
1216

1317
const githubToken = 'github_token';
14-
const client = proxyquire('../lib/get-client', {'./definitions/rate-limit': rateLimit})({githubToken});
18+
const client =getClient({githubToken});
1519

1620
test.beforeEach((t) => {
1721
// Mock logger
18-
t.context.log = stub();
19-
t.context.error = stub();
22+
t.context.log = sinon.stub();
23+
t.context.error = sinon.stub();
2024
t.context.logger = {log: t.context.log, error: t.context.error};
2125
});
2226

2327
test.afterEach.always(() => {
2428
// Clear nock
25-
cleanAll();
29+
nock.cleanAll();
2630
});
2731

2832
test.serial('Filter out issues without ID', async (t) => {

0 commit comments

Comments
 (0)