Skip to content

Commit 3ea3b37

Browse files
committed
chore: fix ci_start tests
1 parent 9a40d21 commit 3ea3b37

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

test/unit/ci_start.test.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('Jenkins', () => {
4343
});
4444
});
4545

46-
it('should fail if starting node-pull-request throws', async() => {
46+
it('should fail if starting node-pull-request throws', async(t) => {
4747
const cli = new TestCLI();
4848
const request = {
4949
fetch: sinon.stub().returns(Promise.resolve({ status: 400 })),
@@ -53,20 +53,20 @@ describe('Jenkins', () => {
5353
};
5454

5555
const jobRunner = new RunPRJob(cli, request, owner, repo, prid, true);
56-
assert.strictEqual(await jobRunner.start(), false);
56+
t.assert.strictEqual(await jobRunner.start(), false);
5757
});
5858

59-
it('should return false if crumb fails', async() => {
59+
it('should return false if crumb fails', async(t) => {
6060
const cli = new TestCLI();
6161
const request = {
6262
json: sinon.stub().throws()
6363
};
6464

6565
const jobRunner = new RunPRJob(cli, request, owner, repo, prid, true);
66-
assert.strictEqual(await jobRunner.start(), false);
66+
t.assert.strictEqual(await jobRunner.start(), false);
6767
});
6868

69-
it('should start node-pull-request', async() => {
69+
it('should start node-pull-request', async(t) => {
7070
const cli = new TestCLI();
7171

7272
const request = {
@@ -81,36 +81,36 @@ describe('Jenkins', () => {
8181
}),
8282
fetch: sinon.stub()
8383
.callsFake((url, { method, headers, body }) => {
84-
assert.strictEqual(url, CI_PR_URL);
85-
assert.strictEqual(method, 'POST');
86-
assert.deepStrictEqual(headers, { 'Jenkins-Crumb': crumb });
87-
assert.ok(body._validated);
84+
t.assert.strictEqual(url, CI_PR_URL);
85+
t.assert.strictEqual(method, 'POST');
86+
t.assert.deepStrictEqual(headers, { 'Jenkins-Crumb': crumb });
87+
t.assert.ok(body._validated);
8888
return Promise.resolve({ status: 201 });
8989
}),
9090
json: sinon.stub().withArgs(CI_CRUMB_URL)
9191
.returns(Promise.resolve({ crumb }))
9292
};
9393
const jobRunner = new RunPRJob(cli, request, owner, repo, prid, true);
94-
assert.ok(await jobRunner.start());
94+
t.assert.ok(await jobRunner.start());
9595
});
9696

97-
it('should return false if node-pull-request not started', async() => {
97+
it('should return false if node-pull-request not started', async(t) => {
9898
const cli = new TestCLI();
9999

100100
const request = {
101101
fetch: sinon.stub()
102102
.callsFake((url, { method, headers, body }) => {
103-
assert.strictEqual(url, CI_PR_URL);
104-
assert.strictEqual(method, 'POST');
105-
assert.deepStrictEqual(headers, { 'Jenkins-Crumb': crumb });
106-
assert.ok(body._validated);
103+
t.assert.strictEqual(url, CI_PR_URL);
104+
t.assert.strictEqual(method, 'POST');
105+
t.assert.deepStrictEqual(headers, { 'Jenkins-Crumb': crumb });
106+
t.assert.ok(body._validated);
107107
return Promise.resolve({ status: 401 });
108108
}),
109109
json: sinon.stub().withArgs(CI_CRUMB_URL)
110110
.returns(Promise.resolve({ crumb }))
111111
};
112112
const jobRunner = new RunPRJob(cli, request, owner, repo, prid, true);
113-
assert.strictEqual(await jobRunner.start(), false);
113+
t.assert.strictEqual(await jobRunner.start(), false);
114114
});
115115

116116
describe('without --certify-safe flag', { concurrency: false }, () => {
@@ -120,7 +120,7 @@ describe('Jenkins', () => {
120120
for (const certifySafe of [true, false]) {
121121
it(`should return ${certifySafe} if PR checker reports it as ${
122122
certifySafe ? '' : 'potentially un'
123-
}safe`, async() => {
123+
}safe`, async(t) => {
124124
const cli = new TestCLI();
125125

126126
sinon.replace(PRChecker.prototype, 'checkCommitsAfterReview',
@@ -138,18 +138,18 @@ describe('Jenkins', () => {
138138
}),
139139
fetch: sinon.stub()
140140
.callsFake((url, { method, headers, body }) => {
141-
assert.strictEqual(url, CI_PR_URL);
142-
assert.strictEqual(method, 'POST');
143-
assert.deepStrictEqual(headers, { 'Jenkins-Crumb': crumb });
144-
assert.ok(body._validated);
141+
t.assert.strictEqual(url, CI_PR_URL);
142+
t.assert.strictEqual(method, 'POST');
143+
t.assert.deepStrictEqual(headers, { 'Jenkins-Crumb': crumb });
144+
t.assert.ok(body._validated);
145145
return Promise.resolve({ status: 201 });
146146
}),
147147
json: sinon.stub().withArgs(CI_CRUMB_URL)
148148
.returns(Promise.resolve({ crumb }))
149149
};
150150

151151
const jobRunner = new RunPRJob(cli, request, owner, repo, prid, false);
152-
assert.strictEqual(await jobRunner.start(), certifySafe);
152+
t.assert.strictEqual(await jobRunner.start(), certifySafe);
153153
});
154154
}
155155
});

0 commit comments

Comments
 (0)