Skip to content

Commit 596cfd5

Browse files
committed
migrate assert.strict => .strictEqual
1 parent be3e8b6 commit 596cfd5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+403
-403
lines changed

test/application/context.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('app.context', () => {
1212

1313
it('should merge properties', () => {
1414
app1.use((ctx, next) => {
15-
assert.equal(ctx.msg, 'hello');
15+
assert.strictEqual(ctx.msg, 'hello');
1616
ctx.status = 204;
1717
});
1818

@@ -23,7 +23,7 @@ describe('app.context', () => {
2323

2424
it('should not affect the original prototype', () => {
2525
app2.use((ctx, next) => {
26-
assert.equal(ctx.msg, undefined);
26+
assert.strictEqual(ctx.msg, undefined);
2727
ctx.status = 204;
2828
});
2929

test/application/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('app', () => {
1515
});
1616

1717
app.on('error', err => {
18-
assert.equal(err.message, 'boom');
18+
assert.strictEqual(err.message, 'boom');
1919
done();
2020
});
2121

@@ -51,7 +51,7 @@ describe('app', () => {
5151
process.env.NODE_ENV = '';
5252
const app = new Koa();
5353
process.env.NODE_ENV = NODE_ENV;
54-
assert.equal(app.env, 'development');
54+
assert.strictEqual(app.env, 'development');
5555
});
5656

5757
it('should set env from the constructor', () => {

test/application/inspect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const app = new Koa();
99
describe('app.inspect()', () => {
1010
it('should work', () => {
1111
const str = util.inspect(app);
12-
assert.equal("{ subdomainOffset: 2, proxy: false, env: 'test' }", str);
12+
assert.strictEqual("{ subdomainOffset: 2, proxy: false, env: 'test' }", str);
1313
});
1414

1515
it('should return a json representation', () => {

test/application/request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('app.request', () => {
1212

1313
it('should merge properties', () => {
1414
app1.use((ctx, next) => {
15-
assert.equal(ctx.request.message, 'hello');
15+
assert.strictEqual(ctx.request.message, 'hello');
1616
ctx.status = 204;
1717
});
1818

@@ -23,7 +23,7 @@ describe('app.request', () => {
2323

2424
it('should not affect the original prototype', () => {
2525
app2.use((ctx, next) => {
26-
assert.equal(ctx.request.message, undefined);
26+
assert.strictEqual(ctx.request.message, undefined);
2727
ctx.status = 204;
2828
});
2929

test/application/respond.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('app.respond', () => {
9696
.get('/')
9797
.expect(200);
9898

99-
assert.equal(res.headers.hasOwnProperty('Content-Type'), false);
99+
assert.strictEqual(res.headers.hasOwnProperty('Content-Type'), false);
100100
});
101101
});
102102

@@ -114,8 +114,8 @@ describe('app.respond', () => {
114114
.head('/')
115115
.expect(200);
116116

117-
assert.equal(res.headers['content-type'], 'text/plain; charset=utf-8');
118-
assert.equal(res.headers['content-length'], '5');
117+
assert.strictEqual(res.headers['content-type'], 'text/plain; charset=utf-8');
118+
assert.strictEqual(res.headers['content-length'], '5');
119119
assert(!res.text);
120120
});
121121

@@ -132,8 +132,8 @@ describe('app.respond', () => {
132132
.head('/')
133133
.expect(200);
134134

135-
assert.equal(res.headers['content-type'], 'application/json; charset=utf-8');
136-
assert.equal(res.headers['content-length'], '17');
135+
assert.strictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
136+
assert.strictEqual(res.headers['content-length'], '17');
137137
assert(!res.text);
138138
});
139139

@@ -150,8 +150,8 @@ describe('app.respond', () => {
150150
.head('/')
151151
.expect(200);
152152

153-
assert.equal(res.headers['content-type'], 'text/plain; charset=utf-8');
154-
assert.equal(res.headers['content-length'], '11');
153+
assert.strictEqual(res.headers['content-type'], 'text/plain; charset=utf-8');
154+
assert.strictEqual(res.headers['content-length'], '11');
155155
assert(!res.text);
156156
});
157157

@@ -168,8 +168,8 @@ describe('app.respond', () => {
168168
.head('/')
169169
.expect(200);
170170

171-
assert.equal(res.headers['content-type'], 'application/octet-stream');
172-
assert.equal(res.headers['content-length'], '11');
171+
assert.strictEqual(res.headers['content-type'], 'application/octet-stream');
172+
assert.strictEqual(res.headers['content-length'], '11');
173173
assert(!res.text);
174174
});
175175

@@ -189,7 +189,7 @@ describe('app.respond', () => {
189189
.head('/')
190190
.expect(200);
191191

192-
assert.equal(res.header['content-length'], length);
192+
assert.strictEqual(res.header['content-length'], length);
193193
assert(!res.text);
194194
});
195195

@@ -329,7 +329,7 @@ describe('app.respond', () => {
329329
.expect(204)
330330
.expect('');
331331

332-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
332+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
333333
});
334334
});
335335

@@ -348,7 +348,7 @@ describe('app.respond', () => {
348348
.expect(205)
349349
.expect('');
350350

351-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
351+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
352352
});
353353
});
354354

@@ -367,7 +367,7 @@ describe('app.respond', () => {
367367
.expect(304)
368368
.expect('');
369369

370-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
370+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
371371
});
372372
});
373373

@@ -387,7 +387,7 @@ describe('app.respond', () => {
387387
.expect(700)
388388
.expect('custom status');
389389

390-
assert.equal(res.res.statusMessage, 'custom status');
390+
assert.strictEqual(res.res.statusMessage, 'custom status');
391391
});
392392
});
393393

@@ -407,7 +407,7 @@ describe('app.respond', () => {
407407
.expect(200)
408408
.expect('ok');
409409

410-
assert.equal(res.res.statusMessage, 'ok');
410+
assert.strictEqual(res.res.statusMessage, 'ok');
411411
});
412412
});
413413

@@ -444,7 +444,7 @@ describe('app.respond', () => {
444444
.expect(204)
445445
.expect('');
446446

447-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
447+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
448448
});
449449

450450
it('should respond 204 with status=200', async() => {
@@ -462,7 +462,7 @@ describe('app.respond', () => {
462462
.expect(204)
463463
.expect('');
464464

465-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
465+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
466466
});
467467

468468
it('should respond 205 with status=205', async() => {
@@ -480,7 +480,7 @@ describe('app.respond', () => {
480480
.expect(205)
481481
.expect('');
482482

483-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
483+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
484484
});
485485

486486
it('should respond 304 with status=304', async() => {
@@ -498,7 +498,7 @@ describe('app.respond', () => {
498498
.expect(304)
499499
.expect('');
500500

501-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
501+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
502502
});
503503
});
504504

@@ -551,7 +551,7 @@ describe('app.respond', () => {
551551
.expect('Content-Type', 'application/json; charset=utf-8');
552552

553553
const pkg = require('../../package');
554-
assert.equal(res.headers.hasOwnProperty('content-length'), false);
554+
assert.strictEqual(res.headers.hasOwnProperty('content-length'), false);
555555
assert.deepEqual(res.body, pkg);
556556
});
557557

@@ -571,7 +571,7 @@ describe('app.respond', () => {
571571
.expect('Content-Type', 'application/json; charset=utf-8');
572572

573573
const pkg = require('../../package');
574-
assert.equal(res.headers.hasOwnProperty('content-length'), false);
574+
assert.strictEqual(res.headers.hasOwnProperty('content-length'), false);
575575
assert.deepEqual(res.body, pkg);
576576
});
577577

@@ -591,7 +591,7 @@ describe('app.respond', () => {
591591
.expect('Content-Type', 'application/json; charset=utf-8');
592592

593593
const pkg = require('../../package');
594-
assert.equal(res.headers.hasOwnProperty('content-length'), true);
594+
assert.strictEqual(res.headers.hasOwnProperty('content-length'), true);
595595
assert.deepEqual(res.body, pkg);
596596
});
597597

@@ -614,7 +614,7 @@ describe('app.respond', () => {
614614
.expect('Content-Type', 'application/json; charset=utf-8');
615615

616616
const pkg = require('../../package');
617-
assert.equal(res.headers.hasOwnProperty('content-length'), true);
617+
assert.strictEqual(res.headers.hasOwnProperty('content-length'), true);
618618
assert.deepEqual(res.body, pkg);
619619
});
620620

@@ -716,7 +716,7 @@ describe('app.respond', () => {
716716
});
717717

718718
app.on('error', err => {
719-
assert.equal(err.message, 'boom');
719+
assert.strictEqual(err.message, 'boom');
720720
done();
721721
});
722722

@@ -829,7 +829,7 @@ describe('app.respond', () => {
829829
.get('/')
830830
.expect(204);
831831

832-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
832+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
833833
});
834834
});
835835

@@ -866,7 +866,7 @@ describe('app.respond', () => {
866866
.expect('')
867867
.expect({});
868868

869-
assert.equal(res.headers.hasOwnProperty('content-type'), false);
869+
assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
870870
});
871871
});
872872
});

test/application/response.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('app.response', () => {
1515

1616
it('should merge properties', () => {
1717
app1.use((ctx, next) => {
18-
assert.equal(ctx.response.msg, 'hello');
18+
assert.strictEqual(ctx.response.msg, 'hello');
1919
ctx.status = 204;
2020
});
2121

@@ -26,7 +26,7 @@ describe('app.response', () => {
2626

2727
it('should not affect the original prototype', () => {
2828
app2.use((ctx, next) => {
29-
assert.equal(ctx.response.msg, undefined);
29+
assert.strictEqual(ctx.response.msg, undefined);
3030
ctx.status = 204;
3131
});
3232

@@ -43,7 +43,7 @@ describe('app.response', () => {
4343
const response = await request(app3.listen())
4444
.get('/')
4545
.expect(404);
46-
assert.equal(response.text, '404');
46+
assert.strictEqual(response.text, '404');
4747
});
4848

4949
it('should set ._explicitNullBody correctly', async() => {

test/context/assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('ctx.assert(value, status)', () => {
1212
ctx.assert(false, 404);
1313
throw new Error('asdf');
1414
} catch (err) {
15-
assert.equal(err.status, 404);
15+
assert.strictEqual(err.status, 404);
1616
assert.strictEqual(err.expose, true);
1717
}
1818
});

test/context/cookies.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('ctx.cookies', () => {
2222
.expect(204);
2323

2424
const cookie = res.headers['set-cookie'].some(cookie => /^name=/.test(cookie));
25-
assert.equal(cookie, true);
25+
assert.strictEqual(cookie, true);
2626
});
2727

2828
describe('with .signed', () => {
@@ -62,8 +62,8 @@ describe('ctx.cookies', () => {
6262

6363
const cookies = res.headers['set-cookie'];
6464

65-
assert.equal(cookies.some(cookie => /^name=/.test(cookie)), true);
66-
assert.equal(cookies.some(cookie => /(,|^)name\.sig=/.test(cookie)), true);
65+
assert.strictEqual(cookies.some(cookie => /^name=/.test(cookie)), true);
66+
assert.strictEqual(cookies.some(cookie => /(,|^)name\.sig=/.test(cookie)), true);
6767
});
6868
});
6969

@@ -87,9 +87,9 @@ describe('ctx.cookies', () => {
8787
.expect(204);
8888

8989
const cookies = res.headers['set-cookie'];
90-
assert.equal(cookies.some(cookie => /^name=/.test(cookie)), true);
91-
assert.equal(cookies.some(cookie => /(,|^)name\.sig=/.test(cookie)), true);
92-
assert.equal(cookies.every(cookie => /secure/.test(cookie)), true);
90+
assert.strictEqual(cookies.some(cookie => /^name=/.test(cookie)), true);
91+
assert.strictEqual(cookies.some(cookie => /(,|^)name\.sig=/.test(cookie)), true);
92+
assert.strictEqual(cookies.every(cookie => /secure/.test(cookie)), true);
9393
});
9494
});
9595
});

test/context/onerror.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ describe('ctx.onerror(err)', () => {
4343
.expect('Content-Type', 'text/plain; charset=utf-8')
4444
.expect('Content-Length', '4');
4545

46-
assert.equal(res.headers.hasOwnProperty('vary'), false);
47-
assert.equal(res.headers.hasOwnProperty('x-csrf-token'), false);
46+
assert.strictEqual(res.headers.hasOwnProperty('vary'), false);
47+
assert.strictEqual(res.headers.hasOwnProperty('x-csrf-token'), false);
4848
});
4949

5050
it('should set headers specified in the error', async() => {
@@ -72,16 +72,16 @@ describe('ctx.onerror(err)', () => {
7272
.expect('Content-Type', 'text/plain; charset=utf-8')
7373
.expect('X-New-Header', 'Value');
7474

75-
assert.equal(res.headers.hasOwnProperty('vary'), false);
76-
assert.equal(res.headers.hasOwnProperty('x-csrf-token'), false);
75+
assert.strictEqual(res.headers.hasOwnProperty('vary'), false);
76+
assert.strictEqual(res.headers.hasOwnProperty('x-csrf-token'), false);
7777
});
7878

7979
it('should ignore error after headerSent', done => {
8080
const app = new Koa();
8181

8282
app.on('error', err => {
83-
assert.equal(err.message, 'mock error');
84-
assert.equal(err.headerSent, true);
83+
assert.strictEqual(err.message, 'mock error');
84+
assert.strictEqual(err.headerSent, true);
8585
done();
8686
});
8787

@@ -269,14 +269,14 @@ describe('ctx.onerror(err)', () => {
269269

270270
ctx.onerror(new Error('error'));
271271

272-
assert.equal(removed, 2);
272+
assert.strictEqual(removed, 2);
273273
});
274274

275275
it('should stringify error if it is an object', done => {
276276
const app = new Koa();
277277

278278
app.on('error', err => {
279-
assert.equal(err, 'Error: non-error thrown: {"key":"value"}');
279+
assert.strictEqual(err, 'Error: non-error thrown: {"key":"value"}');
280280
done();
281281
});
282282

0 commit comments

Comments
 (0)