diff --git a/test/application/context.js b/test/application/context.js
index bd5b9cbf8..ec4bc1823 100644
--- a/test/application/context.js
+++ b/test/application/context.js
@@ -12,7 +12,7 @@ describe('app.context', () => {
it('should merge properties', () => {
app1.use((ctx, next) => {
- assert.equal(ctx.msg, 'hello');
+ assert.strictEqual(ctx.msg, 'hello');
ctx.status = 204;
});
@@ -23,7 +23,7 @@ describe('app.context', () => {
it('should not affect the original prototype', () => {
app2.use((ctx, next) => {
- assert.equal(ctx.msg, undefined);
+ assert.strictEqual(ctx.msg, undefined);
ctx.status = 204;
});
diff --git a/test/application/index.js b/test/application/index.js
index ec5ea25b1..64037a001 100644
--- a/test/application/index.js
+++ b/test/application/index.js
@@ -15,7 +15,7 @@ describe('app', () => {
});
app.on('error', err => {
- assert.equal(err.message, 'boom');
+ assert.strictEqual(err.message, 'boom');
done();
});
@@ -51,7 +51,7 @@ describe('app', () => {
process.env.NODE_ENV = '';
const app = new Koa();
process.env.NODE_ENV = NODE_ENV;
- assert.equal(app.env, 'development');
+ assert.strictEqual(app.env, 'development');
});
it('should set env from the constructor', () => {
diff --git a/test/application/inspect.js b/test/application/inspect.js
index 799201ce0..73bd34d23 100644
--- a/test/application/inspect.js
+++ b/test/application/inspect.js
@@ -9,7 +9,7 @@ const app = new Koa();
describe('app.inspect()', () => {
it('should work', () => {
const str = util.inspect(app);
- assert.equal("{ subdomainOffset: 2, proxy: false, env: 'test' }", str);
+ assert.strictEqual("{ subdomainOffset: 2, proxy: false, env: 'test' }", str);
});
it('should return a json representation', () => {
diff --git a/test/application/request.js b/test/application/request.js
index c852f7fe6..3e79887c5 100644
--- a/test/application/request.js
+++ b/test/application/request.js
@@ -12,7 +12,7 @@ describe('app.request', () => {
it('should merge properties', () => {
app1.use((ctx, next) => {
- assert.equal(ctx.request.message, 'hello');
+ assert.strictEqual(ctx.request.message, 'hello');
ctx.status = 204;
});
@@ -23,7 +23,7 @@ describe('app.request', () => {
it('should not affect the original prototype', () => {
app2.use((ctx, next) => {
- assert.equal(ctx.request.message, undefined);
+ assert.strictEqual(ctx.request.message, undefined);
ctx.status = 204;
});
diff --git a/test/application/respond.js b/test/application/respond.js
index 1f9a17118..29e650d61 100644
--- a/test/application/respond.js
+++ b/test/application/respond.js
@@ -96,7 +96,7 @@ describe('app.respond', () => {
.get('/')
.expect(200);
- assert.equal(res.headers.hasOwnProperty('Content-Type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('Content-Type'), false);
});
});
@@ -114,8 +114,8 @@ describe('app.respond', () => {
.head('/')
.expect(200);
- assert.equal(res.headers['content-type'], 'text/plain; charset=utf-8');
- assert.equal(res.headers['content-length'], '5');
+ assert.strictEqual(res.headers['content-type'], 'text/plain; charset=utf-8');
+ assert.strictEqual(res.headers['content-length'], '5');
assert(!res.text);
});
@@ -132,8 +132,8 @@ describe('app.respond', () => {
.head('/')
.expect(200);
- assert.equal(res.headers['content-type'], 'application/json; charset=utf-8');
- assert.equal(res.headers['content-length'], '17');
+ assert.strictEqual(res.headers['content-type'], 'application/json; charset=utf-8');
+ assert.strictEqual(res.headers['content-length'], '17');
assert(!res.text);
});
@@ -150,8 +150,8 @@ describe('app.respond', () => {
.head('/')
.expect(200);
- assert.equal(res.headers['content-type'], 'text/plain; charset=utf-8');
- assert.equal(res.headers['content-length'], '11');
+ assert.strictEqual(res.headers['content-type'], 'text/plain; charset=utf-8');
+ assert.strictEqual(res.headers['content-length'], '11');
assert(!res.text);
});
@@ -168,8 +168,8 @@ describe('app.respond', () => {
.head('/')
.expect(200);
- assert.equal(res.headers['content-type'], 'application/octet-stream');
- assert.equal(res.headers['content-length'], '11');
+ assert.strictEqual(res.headers['content-type'], 'application/octet-stream');
+ assert.strictEqual(res.headers['content-length'], '11');
assert(!res.text);
});
@@ -189,7 +189,7 @@ describe('app.respond', () => {
.head('/')
.expect(200);
- assert.equal(res.header['content-length'], length);
+ assert.strictEqual(res.header['content-length'], length);
assert(!res.text);
});
@@ -329,7 +329,7 @@ describe('app.respond', () => {
.expect(204)
.expect('');
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
});
@@ -348,7 +348,7 @@ describe('app.respond', () => {
.expect(205)
.expect('');
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
});
@@ -367,7 +367,7 @@ describe('app.respond', () => {
.expect(304)
.expect('');
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
});
@@ -387,7 +387,7 @@ describe('app.respond', () => {
.expect(700)
.expect('custom status');
- assert.equal(res.res.statusMessage, 'custom status');
+ assert.strictEqual(res.res.statusMessage, 'custom status');
});
});
@@ -407,7 +407,7 @@ describe('app.respond', () => {
.expect(200)
.expect('ok');
- assert.equal(res.res.statusMessage, 'ok');
+ assert.strictEqual(res.res.statusMessage, 'ok');
});
});
@@ -444,7 +444,7 @@ describe('app.respond', () => {
.expect(204)
.expect('');
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
it('should respond 204 with status=200', async() => {
@@ -462,7 +462,7 @@ describe('app.respond', () => {
.expect(204)
.expect('');
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
it('should respond 205 with status=205', async() => {
@@ -480,7 +480,7 @@ describe('app.respond', () => {
.expect(205)
.expect('');
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
it('should respond 304 with status=304', async() => {
@@ -498,7 +498,7 @@ describe('app.respond', () => {
.expect(304)
.expect('');
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
});
@@ -551,7 +551,7 @@ describe('app.respond', () => {
.expect('Content-Type', 'application/json; charset=utf-8');
const pkg = require('../../package');
- assert.equal(res.headers.hasOwnProperty('content-length'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-length'), false);
assert.deepEqual(res.body, pkg);
});
@@ -571,7 +571,7 @@ describe('app.respond', () => {
.expect('Content-Type', 'application/json; charset=utf-8');
const pkg = require('../../package');
- assert.equal(res.headers.hasOwnProperty('content-length'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-length'), false);
assert.deepEqual(res.body, pkg);
});
@@ -591,7 +591,7 @@ describe('app.respond', () => {
.expect('Content-Type', 'application/json; charset=utf-8');
const pkg = require('../../package');
- assert.equal(res.headers.hasOwnProperty('content-length'), true);
+ assert.strictEqual(res.headers.hasOwnProperty('content-length'), true);
assert.deepEqual(res.body, pkg);
});
@@ -614,7 +614,7 @@ describe('app.respond', () => {
.expect('Content-Type', 'application/json; charset=utf-8');
const pkg = require('../../package');
- assert.equal(res.headers.hasOwnProperty('content-length'), true);
+ assert.strictEqual(res.headers.hasOwnProperty('content-length'), true);
assert.deepEqual(res.body, pkg);
});
@@ -716,7 +716,7 @@ describe('app.respond', () => {
});
app.on('error', err => {
- assert.equal(err.message, 'boom');
+ assert.strictEqual(err.message, 'boom');
done();
});
@@ -829,7 +829,7 @@ describe('app.respond', () => {
.get('/')
.expect(204);
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
});
@@ -866,7 +866,7 @@ describe('app.respond', () => {
.expect('')
.expect({});
- assert.equal(res.headers.hasOwnProperty('content-type'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('content-type'), false);
});
});
});
diff --git a/test/application/response.js b/test/application/response.js
index c9c725334..1ed5571e1 100644
--- a/test/application/response.js
+++ b/test/application/response.js
@@ -15,7 +15,7 @@ describe('app.response', () => {
it('should merge properties', () => {
app1.use((ctx, next) => {
- assert.equal(ctx.response.msg, 'hello');
+ assert.strictEqual(ctx.response.msg, 'hello');
ctx.status = 204;
});
@@ -26,7 +26,7 @@ describe('app.response', () => {
it('should not affect the original prototype', () => {
app2.use((ctx, next) => {
- assert.equal(ctx.response.msg, undefined);
+ assert.strictEqual(ctx.response.msg, undefined);
ctx.status = 204;
});
@@ -43,7 +43,7 @@ describe('app.response', () => {
const response = await request(app3.listen())
.get('/')
.expect(404);
- assert.equal(response.text, '404');
+ assert.strictEqual(response.text, '404');
});
it('should set ._explicitNullBody correctly', async() => {
diff --git a/test/context/assert.js b/test/context/assert.js
index ff4243c7d..bc535a03c 100644
--- a/test/context/assert.js
+++ b/test/context/assert.js
@@ -12,7 +12,7 @@ describe('ctx.assert(value, status)', () => {
ctx.assert(false, 404);
throw new Error('asdf');
} catch (err) {
- assert.equal(err.status, 404);
+ assert.strictEqual(err.status, 404);
assert.strictEqual(err.expose, true);
}
});
diff --git a/test/context/cookies.js b/test/context/cookies.js
index 4644f37d1..23e949758 100644
--- a/test/context/cookies.js
+++ b/test/context/cookies.js
@@ -22,7 +22,7 @@ describe('ctx.cookies', () => {
.expect(204);
const cookie = res.headers['set-cookie'].some(cookie => /^name=/.test(cookie));
- assert.equal(cookie, true);
+ assert.strictEqual(cookie, true);
});
describe('with .signed', () => {
@@ -62,8 +62,8 @@ describe('ctx.cookies', () => {
const cookies = res.headers['set-cookie'];
- assert.equal(cookies.some(cookie => /^name=/.test(cookie)), true);
- assert.equal(cookies.some(cookie => /(,|^)name\.sig=/.test(cookie)), true);
+ assert.strictEqual(cookies.some(cookie => /^name=/.test(cookie)), true);
+ assert.strictEqual(cookies.some(cookie => /(,|^)name\.sig=/.test(cookie)), true);
});
});
@@ -87,9 +87,9 @@ describe('ctx.cookies', () => {
.expect(204);
const cookies = res.headers['set-cookie'];
- assert.equal(cookies.some(cookie => /^name=/.test(cookie)), true);
- assert.equal(cookies.some(cookie => /(,|^)name\.sig=/.test(cookie)), true);
- assert.equal(cookies.every(cookie => /secure/.test(cookie)), true);
+ assert.strictEqual(cookies.some(cookie => /^name=/.test(cookie)), true);
+ assert.strictEqual(cookies.some(cookie => /(,|^)name\.sig=/.test(cookie)), true);
+ assert.strictEqual(cookies.every(cookie => /secure/.test(cookie)), true);
});
});
});
diff --git a/test/context/onerror.js b/test/context/onerror.js
index 098df8ad4..1fa729c82 100644
--- a/test/context/onerror.js
+++ b/test/context/onerror.js
@@ -43,8 +43,8 @@ describe('ctx.onerror(err)', () => {
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('Content-Length', '4');
- assert.equal(res.headers.hasOwnProperty('vary'), false);
- assert.equal(res.headers.hasOwnProperty('x-csrf-token'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('vary'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('x-csrf-token'), false);
});
it('should set headers specified in the error', async() => {
@@ -72,16 +72,16 @@ describe('ctx.onerror(err)', () => {
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect('X-New-Header', 'Value');
- assert.equal(res.headers.hasOwnProperty('vary'), false);
- assert.equal(res.headers.hasOwnProperty('x-csrf-token'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('vary'), false);
+ assert.strictEqual(res.headers.hasOwnProperty('x-csrf-token'), false);
});
it('should ignore error after headerSent', done => {
const app = new Koa();
app.on('error', err => {
- assert.equal(err.message, 'mock error');
- assert.equal(err.headerSent, true);
+ assert.strictEqual(err.message, 'mock error');
+ assert.strictEqual(err.headerSent, true);
done();
});
@@ -269,14 +269,14 @@ describe('ctx.onerror(err)', () => {
ctx.onerror(new Error('error'));
- assert.equal(removed, 2);
+ assert.strictEqual(removed, 2);
});
it('should stringify error if it is an object', done => {
const app = new Koa();
app.on('error', err => {
- assert.equal(err, 'Error: non-error thrown: {"key":"value"}');
+ assert.strictEqual(err, 'Error: non-error thrown: {"key":"value"}');
done();
});
diff --git a/test/context/throw.js b/test/context/throw.js
index 5c091c8c6..4751af44a 100644
--- a/test/context/throw.js
+++ b/test/context/throw.js
@@ -11,8 +11,8 @@ describe('ctx.throw(msg)', () => {
try {
ctx.throw('boom');
} catch (err) {
- assert.equal(err.status, 500);
- assert.equal(err.expose, false);
+ assert.strictEqual(err.status, 500);
+ assert.strictEqual(err.expose, false);
}
});
});
@@ -25,9 +25,9 @@ describe('ctx.throw(err)', () => {
try {
ctx.throw(err);
} catch (err) {
- assert.equal(err.status, 500);
- assert.equal(err.message, 'test');
- assert.equal(err.expose, false);
+ assert.strictEqual(err.status, 500);
+ assert.strictEqual(err.message, 'test');
+ assert.strictEqual(err.expose, false);
}
});
});
@@ -40,9 +40,9 @@ describe('ctx.throw(err, status)', () => {
try {
ctx.throw(error, 422);
} catch (err) {
- assert.equal(err.status, 422);
- assert.equal(err.message, 'test');
- assert.equal(err.expose, true);
+ assert.strictEqual(err.status, 422);
+ assert.strictEqual(err.message, 'test');
+ assert.strictEqual(err.expose, true);
}
});
});
@@ -55,9 +55,9 @@ describe('ctx.throw(status, err)', () => {
try {
ctx.throw(422, error);
} catch (err) {
- assert.equal(err.status, 422);
- assert.equal(err.message, 'test');
- assert.equal(err.expose, true);
+ assert.strictEqual(err.status, 422);
+ assert.strictEqual(err.message, 'test');
+ assert.strictEqual(err.expose, true);
}
});
});
@@ -69,9 +69,9 @@ describe('ctx.throw(msg, status)', () => {
try {
ctx.throw('name required', 400);
} catch (err) {
- assert.equal(err.message, 'name required');
- assert.equal(err.status, 400);
- assert.equal(err.expose, true);
+ assert.strictEqual(err.message, 'name required');
+ assert.strictEqual(err.status, 400);
+ assert.strictEqual(err.expose, true);
}
});
});
@@ -83,9 +83,9 @@ describe('ctx.throw(status, msg)', () => {
try {
ctx.throw(400, 'name required');
} catch (err) {
- assert.equal(err.message, 'name required');
- assert.equal(400, err.status);
- assert.equal(true, err.expose);
+ assert.strictEqual(err.message, 'name required');
+ assert.strictEqual(400, err.status);
+ assert.strictEqual(true, err.expose);
}
});
});
@@ -97,9 +97,9 @@ describe('ctx.throw(status)', () => {
try {
ctx.throw(400);
} catch (err) {
- assert.equal(err.message, 'Bad Request');
- assert.equal(err.status, 400);
- assert.equal(err.expose, true);
+ assert.strictEqual(err.message, 'Bad Request');
+ assert.strictEqual(err.status, 400);
+ assert.strictEqual(err.expose, true);
}
});
@@ -112,8 +112,8 @@ describe('ctx.throw(status)', () => {
err.status = -1;
ctx.throw(err);
} catch (err) {
- assert.equal(err.message, 'some error');
- assert.equal(err.expose, false);
+ assert.strictEqual(err.message, 'some error');
+ assert.strictEqual(err.expose, false);
}
});
});
@@ -126,10 +126,10 @@ describe('ctx.throw(status, msg, props)', () => {
try {
ctx.throw(400, 'msg', { prop: true });
} catch (err) {
- assert.equal(err.message, 'msg');
- assert.equal(err.status, 400);
- assert.equal(err.expose, true);
- assert.equal(err.prop, true);
+ assert.strictEqual(err.message, 'msg');
+ assert.strictEqual(err.status, 400);
+ assert.strictEqual(err.expose, true);
+ assert.strictEqual(err.prop, true);
}
});
@@ -143,10 +143,10 @@ describe('ctx.throw(status, msg, props)', () => {
status: -1
});
} catch (err) {
- assert.equal(err.message, 'msg');
- assert.equal(err.status, 400);
- assert.equal(err.expose, true);
- assert.equal(err.prop, true);
+ assert.strictEqual(err.message, 'msg');
+ assert.strictEqual(err.status, 400);
+ assert.strictEqual(err.expose, true);
+ assert.strictEqual(err.prop, true);
}
});
});
@@ -159,10 +159,10 @@ describe('ctx.throw(msg, props)', () => {
try {
ctx.throw('msg', { prop: true });
} catch (err) {
- assert.equal(err.message, 'msg');
- assert.equal(err.status, 500);
- assert.equal(err.expose, false);
- assert.equal(err.prop, true);
+ assert.strictEqual(err.message, 'msg');
+ assert.strictEqual(err.status, 500);
+ assert.strictEqual(err.expose, false);
+ assert.strictEqual(err.prop, true);
}
});
});
@@ -174,10 +174,10 @@ describe('ctx.throw(status, props)', () => {
try {
ctx.throw(400, { prop: true });
} catch (err) {
- assert.equal(err.message, 'Bad Request');
- assert.equal(err.status, 400);
- assert.equal(err.expose, true);
- assert.equal(err.prop, true);
+ assert.strictEqual(err.message, 'Bad Request');
+ assert.strictEqual(err.status, 400);
+ assert.strictEqual(err.expose, true);
+ assert.strictEqual(err.prop, true);
}
});
});
@@ -189,10 +189,10 @@ describe('ctx.throw(err, props)', () => {
try {
ctx.throw(new Error('test'), { prop: true });
} catch (err) {
- assert.equal(err.message, 'test');
- assert.equal(err.status, 500);
- assert.equal(err.expose, false);
- assert.equal(err.prop, true);
+ assert.strictEqual(err.message, 'test');
+ assert.strictEqual(err.status, 500);
+ assert.strictEqual(err.expose, false);
+ assert.strictEqual(err.prop, true);
}
});
});
diff --git a/test/request/accepts.js b/test/request/accepts.js
index 4c680d942..b29877844 100644
--- a/test/request/accepts.js
+++ b/test/request/accepts.js
@@ -20,14 +20,14 @@ describe('ctx.accepts(types)', () => {
it('should return false', () => {
const ctx = context();
ctx.req.headers.accept = 'application/*;q=0.2, image/jpeg;q=0.8, text/html, text/plain';
- assert.equal(ctx.accepts('image/png', 'image/tiff'), false);
+ assert.strictEqual(ctx.accepts('image/png', 'image/tiff'), false);
});
});
describe('when Accept is not populated', () => {
it('should return the first type', () => {
const ctx = context();
- assert.equal(ctx.accepts('text/html', 'text/plain', 'image/jpeg', 'application/*'), 'text/html');
+ assert.strictEqual(ctx.accepts('text/html', 'text/plain', 'image/jpeg', 'application/*'), 'text/html');
});
});
});
@@ -36,11 +36,11 @@ describe('ctx.accepts(types)', () => {
it('should convert to mime types', () => {
const ctx = context();
ctx.req.headers.accept = 'text/plain, text/html';
- assert.equal(ctx.accepts('html'), 'html');
- assert.equal(ctx.accepts('.html'), '.html');
- assert.equal(ctx.accepts('txt'), 'txt');
- assert.equal(ctx.accepts('.txt'), '.txt');
- assert.equal(ctx.accepts('png'), false);
+ assert.strictEqual(ctx.accepts('html'), 'html');
+ assert.strictEqual(ctx.accepts('.html'), '.html');
+ assert.strictEqual(ctx.accepts('txt'), 'txt');
+ assert.strictEqual(ctx.accepts('.txt'), '.txt');
+ assert.strictEqual(ctx.accepts('png'), false);
});
});
@@ -48,8 +48,8 @@ describe('ctx.accepts(types)', () => {
it('should return the first match', () => {
const ctx = context();
ctx.req.headers.accept = 'text/plain, text/html';
- assert.equal(ctx.accepts(['png', 'text', 'html']), 'text');
- assert.equal(ctx.accepts(['png', 'html']), 'html');
+ assert.strictEqual(ctx.accepts(['png', 'text', 'html']), 'text');
+ assert.strictEqual(ctx.accepts(['png', 'html']), 'html');
});
});
@@ -57,8 +57,8 @@ describe('ctx.accepts(types)', () => {
it('should return the first match', () => {
const ctx = context();
ctx.req.headers.accept = 'text/plain, text/html';
- assert.equal(ctx.accepts('png', 'text', 'html'), 'text');
- assert.equal(ctx.accepts('png', 'html'), 'html');
+ assert.strictEqual(ctx.accepts('png', 'text', 'html'), 'text');
+ assert.strictEqual(ctx.accepts('png', 'html'), 'html');
});
});
@@ -66,8 +66,8 @@ describe('ctx.accepts(types)', () => {
it('should return the type', () => {
const ctx = context();
ctx.req.headers.accept = 'text/plain, text/html';
- assert.equal(ctx.accepts('text/html'), 'text/html');
- assert.equal(ctx.accepts('text/plain'), 'text/plain');
+ assert.strictEqual(ctx.accepts('text/html'), 'text/html');
+ assert.strictEqual(ctx.accepts('text/plain'), 'text/plain');
});
});
@@ -75,9 +75,9 @@ describe('ctx.accepts(types)', () => {
it('should return the type', () => {
const ctx = context();
ctx.req.headers.accept = 'application/json, */*';
- assert.equal(ctx.accepts('text/html'), 'text/html');
- assert.equal(ctx.accepts('text/plain'), 'text/plain');
- assert.equal(ctx.accepts('image/png'), 'image/png');
+ assert.strictEqual(ctx.accepts('text/html'), 'text/html');
+ assert.strictEqual(ctx.accepts('text/plain'), 'text/plain');
+ assert.strictEqual(ctx.accepts('image/png'), 'image/png');
});
});
@@ -85,10 +85,10 @@ describe('ctx.accepts(types)', () => {
it('should return the type', () => {
const ctx = context();
ctx.req.headers.accept = 'application/json, text/*';
- assert.equal(ctx.accepts('text/html'), 'text/html');
- assert.equal(ctx.accepts('text/plain'), 'text/plain');
- assert.equal(ctx.accepts('image/png'), false);
- assert.equal(ctx.accepts('png'), false);
+ assert.strictEqual(ctx.accepts('text/html'), 'text/html');
+ assert.strictEqual(ctx.accepts('text/plain'), 'text/plain');
+ assert.strictEqual(ctx.accepts('image/png'), false);
+ assert.strictEqual(ctx.accepts('png'), false);
});
});
});
diff --git a/test/request/acceptsCharsets.js b/test/request/acceptsCharsets.js
index 0f09200e2..5b317cfa7 100644
--- a/test/request/acceptsCharsets.js
+++ b/test/request/acceptsCharsets.js
@@ -21,7 +21,7 @@ describe('ctx.acceptsCharsets()', () => {
it('should return the best fit', () => {
const ctx = context();
ctx.req.headers['accept-charset'] = 'utf-8, iso-8859-1;q=0.2, utf-7;q=0.5';
- assert.equal(ctx.acceptsCharsets('utf-7', 'utf-8'), 'utf-8');
+ assert.strictEqual(ctx.acceptsCharsets('utf-7', 'utf-8'), 'utf-8');
});
});
@@ -29,7 +29,7 @@ describe('ctx.acceptsCharsets()', () => {
it('should return false', () => {
const ctx = context();
ctx.req.headers['accept-charset'] = 'utf-8, iso-8859-1;q=0.2, utf-7;q=0.5';
- assert.equal(ctx.acceptsCharsets('utf-16'), false);
+ assert.strictEqual(ctx.acceptsCharsets('utf-16'), false);
});
});
});
@@ -37,7 +37,7 @@ describe('ctx.acceptsCharsets()', () => {
describe('when Accept-Charset is not populated', () => {
it('should return the first type', () => {
const ctx = context();
- assert.equal(ctx.acceptsCharsets('utf-7', 'utf-8'), 'utf-7');
+ assert.strictEqual(ctx.acceptsCharsets('utf-7', 'utf-8'), 'utf-7');
});
});
});
@@ -46,7 +46,7 @@ describe('ctx.acceptsCharsets()', () => {
it('should return the best fit', () => {
const ctx = context();
ctx.req.headers['accept-charset'] = 'utf-8, iso-8859-1;q=0.2, utf-7;q=0.5';
- assert.equal(ctx.acceptsCharsets(['utf-7', 'utf-8']), 'utf-8');
+ assert.strictEqual(ctx.acceptsCharsets(['utf-7', 'utf-8']), 'utf-8');
});
});
});
diff --git a/test/request/acceptsEncodings.js b/test/request/acceptsEncodings.js
index 13a5da80c..92e6f331f 100644
--- a/test/request/acceptsEncodings.js
+++ b/test/request/acceptsEncodings.js
@@ -11,7 +11,7 @@ describe('ctx.acceptsEncodings()', () => {
const ctx = context();
ctx.req.headers['accept-encoding'] = 'gzip, compress;q=0.2';
assert.deepEqual(ctx.acceptsEncodings(), ['gzip', 'compress', 'identity']);
- assert.equal(ctx.acceptsEncodings('gzip', 'compress'), 'gzip');
+ assert.strictEqual(ctx.acceptsEncodings('gzip', 'compress'), 'gzip');
});
});
@@ -19,7 +19,7 @@ describe('ctx.acceptsEncodings()', () => {
it('should return identity', () => {
const ctx = context();
assert.deepEqual(ctx.acceptsEncodings(), ['identity']);
- assert.equal(ctx.acceptsEncodings('gzip', 'deflate', 'identity'), 'identity');
+ assert.strictEqual(ctx.acceptsEncodings('gzip', 'deflate', 'identity'), 'identity');
});
});
});
@@ -28,8 +28,8 @@ describe('ctx.acceptsEncodings()', () => {
it('should return the best fit', () => {
const ctx = context();
ctx.req.headers['accept-encoding'] = 'gzip, compress;q=0.2';
- assert.equal(ctx.acceptsEncodings('compress', 'gzip'), 'gzip');
- assert.equal(ctx.acceptsEncodings('gzip', 'compress'), 'gzip');
+ assert.strictEqual(ctx.acceptsEncodings('compress', 'gzip'), 'gzip');
+ assert.strictEqual(ctx.acceptsEncodings('gzip', 'compress'), 'gzip');
});
});
@@ -37,7 +37,7 @@ describe('ctx.acceptsEncodings()', () => {
it('should return the best fit', () => {
const ctx = context();
ctx.req.headers['accept-encoding'] = 'gzip, compress;q=0.2';
- assert.equal(ctx.acceptsEncodings(['compress', 'gzip']), 'gzip');
+ assert.strictEqual(ctx.acceptsEncodings(['compress', 'gzip']), 'gzip');
});
});
});
diff --git a/test/request/acceptsLanguages.js b/test/request/acceptsLanguages.js
index 7c84160b1..d9a33a574 100644
--- a/test/request/acceptsLanguages.js
+++ b/test/request/acceptsLanguages.js
@@ -21,7 +21,7 @@ describe('ctx.acceptsLanguages(langs)', () => {
it('should return the best fit', () => {
const ctx = context();
ctx.req.headers['accept-language'] = 'en;q=0.8, es, pt';
- assert.equal(ctx.acceptsLanguages('es', 'en'), 'es');
+ assert.strictEqual(ctx.acceptsLanguages('es', 'en'), 'es');
});
});
@@ -29,7 +29,7 @@ describe('ctx.acceptsLanguages(langs)', () => {
it('should return false', () => {
const ctx = context();
ctx.req.headers['accept-language'] = 'en;q=0.8, es, pt';
- assert.equal(ctx.acceptsLanguages('fr', 'au'), false);
+ assert.strictEqual(ctx.acceptsLanguages('fr', 'au'), false);
});
});
});
@@ -37,7 +37,7 @@ describe('ctx.acceptsLanguages(langs)', () => {
describe('when Accept-Language is not populated', () => {
it('should return the first type', () => {
const ctx = context();
- assert.equal(ctx.acceptsLanguages('es', 'en'), 'es');
+ assert.strictEqual(ctx.acceptsLanguages('es', 'en'), 'es');
});
});
});
@@ -46,7 +46,7 @@ describe('ctx.acceptsLanguages(langs)', () => {
it('should return the best fit', () => {
const ctx = context();
ctx.req.headers['accept-language'] = 'en;q=0.8, es, pt';
- assert.equal(ctx.acceptsLanguages(['es', 'en']), 'es');
+ assert.strictEqual(ctx.acceptsLanguages(['es', 'en']), 'es');
});
});
});
diff --git a/test/request/charset.js b/test/request/charset.js
index f2c01f8a4..832251a51 100644
--- a/test/request/charset.js
+++ b/test/request/charset.js
@@ -24,13 +24,13 @@ describe('req.charset', () => {
it('should return the charset', () => {
const req = request();
req.header['content-type'] = 'text/plain; charset=utf-8';
- assert.equal(req.charset, 'utf-8');
+ assert.strictEqual(req.charset, 'utf-8');
});
it('should return "" if content-type is invalid', () => {
const req = request();
req.header['content-type'] = 'application/json; application/text; charset=utf-8';
- assert.equal(req.charset, '');
+ assert.strictEqual(req.charset, '');
});
});
});
diff --git a/test/request/fresh.js b/test/request/fresh.js
index b452c1d6c..42ab3e74a 100644
--- a/test/request/fresh.js
+++ b/test/request/fresh.js
@@ -9,7 +9,7 @@ describe('ctx.fresh', () => {
it('should return false', () => {
const ctx = context();
ctx.req.method = 'POST';
- assert.equal(ctx.fresh, false);
+ assert.strictEqual(ctx.fresh, false);
});
});
@@ -20,7 +20,7 @@ describe('ctx.fresh', () => {
ctx.req.method = 'GET';
ctx.req.headers['if-none-match'] = '123';
ctx.set('ETag', '123');
- assert.equal(ctx.fresh, false);
+ assert.strictEqual(ctx.fresh, false);
});
});
@@ -32,7 +32,7 @@ describe('ctx.fresh', () => {
ctx.req.method = 'GET';
ctx.req.headers['if-none-match'] = '123';
ctx.set('ETag', '123');
- assert.equal(ctx.fresh, true);
+ assert.strictEqual(ctx.fresh, true);
});
});
@@ -43,7 +43,7 @@ describe('ctx.fresh', () => {
ctx.req.method = 'GET';
ctx.req.headers['if-none-match'] = '123';
ctx.set('ETag', 'hey');
- assert.equal(ctx.fresh, false);
+ assert.strictEqual(ctx.fresh, false);
});
});
});
diff --git a/test/request/get.js b/test/request/get.js
index 98e1c1275..fc9a96a8f 100644
--- a/test/request/get.js
+++ b/test/request/get.js
@@ -9,10 +9,10 @@ describe('ctx.get(name)', () => {
const ctx = context();
ctx.req.headers.host = 'http://google.com';
ctx.req.headers.referer = 'http://google.com';
- assert.equal(ctx.get('HOST'), 'http://google.com');
- assert.equal(ctx.get('Host'), 'http://google.com');
- assert.equal(ctx.get('host'), 'http://google.com');
- assert.equal(ctx.get('referer'), 'http://google.com');
- assert.equal(ctx.get('referrer'), 'http://google.com');
+ assert.strictEqual(ctx.get('HOST'), 'http://google.com');
+ assert.strictEqual(ctx.get('Host'), 'http://google.com');
+ assert.strictEqual(ctx.get('host'), 'http://google.com');
+ assert.strictEqual(ctx.get('referer'), 'http://google.com');
+ assert.strictEqual(ctx.get('referrer'), 'http://google.com');
});
});
diff --git a/test/request/host.js b/test/request/host.js
index 0ad94868e..b56fc706a 100644
--- a/test/request/host.js
+++ b/test/request/host.js
@@ -8,13 +8,13 @@ describe('req.host', () => {
it('should return host with port', () => {
const req = request();
req.header.host = 'foo.com:3000';
- assert.equal(req.host, 'foo.com:3000');
+ assert.strictEqual(req.host, 'foo.com:3000');
});
describe('with no host present', () => {
it('should return ""', () => {
const req = request();
- assert.equal(req.host, '');
+ assert.strictEqual(req.host, '');
});
});
@@ -26,7 +26,7 @@ describe('req.host', () => {
});
req.header[':authority'] = 'foo.com:3000';
req.header.host = 'bar.com:8000';
- assert.equal(req.host, 'bar.com:8000');
+ assert.strictEqual(req.host, 'bar.com:8000');
});
});
@@ -38,7 +38,7 @@ describe('req.host', () => {
});
req.header[':authority'] = 'foo.com:3000';
req.header.host = 'bar.com:8000';
- assert.equal(req.host, 'foo.com:3000');
+ assert.strictEqual(req.host, 'foo.com:3000');
});
it('should use host header as fallback', () => {
@@ -47,7 +47,7 @@ describe('req.host', () => {
'httpVersion': '2.0'
});
req.header.host = 'bar.com:8000';
- assert.equal(req.host, 'bar.com:8000');
+ assert.strictEqual(req.host, 'bar.com:8000');
});
});
@@ -57,7 +57,7 @@ describe('req.host', () => {
const req = request();
req.header['x-forwarded-host'] = 'bar.com';
req.header.host = 'foo.com';
- assert.equal(req.host, 'foo.com');
+ assert.strictEqual(req.host, 'foo.com');
});
it('should be ignored on HTTP/2', () => {
@@ -68,7 +68,7 @@ describe('req.host', () => {
req.header['x-forwarded-host'] = 'proxy.com:8080';
req.header[':authority'] = 'foo.com:3000';
req.header.host = 'bar.com:8000';
- assert.equal(req.host, 'foo.com:3000');
+ assert.strictEqual(req.host, 'foo.com:3000');
});
});
@@ -78,7 +78,7 @@ describe('req.host', () => {
req.app.proxy = true;
req.header['x-forwarded-host'] = 'bar.com, baz.com';
req.header.host = 'foo.com';
- assert.equal(req.host, 'bar.com');
+ assert.strictEqual(req.host, 'bar.com');
});
it('should be used on HTTP/2', () => {
@@ -90,7 +90,7 @@ describe('req.host', () => {
req.header['x-forwarded-host'] = 'proxy.com:8080';
req.header[':authority'] = 'foo.com:3000';
req.header.host = 'bar.com:8000';
- assert.equal(req.host, 'proxy.com:8080');
+ assert.strictEqual(req.host, 'proxy.com:8080');
});
});
});
diff --git a/test/request/hostname.js b/test/request/hostname.js
index dd9c61da1..bc70de1f1 100644
--- a/test/request/hostname.js
+++ b/test/request/hostname.js
@@ -8,13 +8,13 @@ describe('req.hostname', () => {
it('should return hostname void of port', () => {
const req = request();
req.header.host = 'foo.com:3000';
- assert.equal(req.hostname, 'foo.com');
+ assert.strictEqual(req.hostname, 'foo.com');
});
describe('with no host present', () => {
it('should return ""', () => {
const req = request();
- assert.equal(req.hostname, '');
+ assert.strictEqual(req.hostname, '');
});
});
@@ -22,31 +22,31 @@ describe('req.hostname', () => {
it('should parse localhost void of port', () => {
const req = request();
req.header.host = '[::1]';
- assert.equal(req.hostname, '[::1]');
+ assert.strictEqual(req.hostname, '[::1]');
});
it('should parse localhost with port 80', () => {
const req = request();
req.header.host = '[::1]:80';
- assert.equal(req.hostname, '[::1]');
+ assert.strictEqual(req.hostname, '[::1]');
});
it('should parse localhost with non-special schema port', () => {
const req = request();
req.header.host = '[::1]:1337';
- assert.equal(req.hostname, '[::1]');
+ assert.strictEqual(req.hostname, '[::1]');
});
it('should reduce IPv6 with non-special schema port as hostname', () => {
const req = request();
req.header.host = '[2001:cdba:0000:0000:0000:0000:3257:9652]:1337';
- assert.equal(req.hostname, '[2001:cdba::3257:9652]');
+ assert.strictEqual(req.hostname, '[2001:cdba::3257:9652]');
});
it('should return empty string when invalid', () => {
const req = request();
req.header.host = '[invalidIPv6]';
- assert.equal(req.hostname, '');
+ assert.strictEqual(req.hostname, '');
});
});
@@ -56,7 +56,7 @@ describe('req.hostname', () => {
const req = request();
req.header['x-forwarded-host'] = 'bar.com';
req.header.host = 'foo.com';
- assert.equal(req.hostname, 'foo.com');
+ assert.strictEqual(req.hostname, 'foo.com');
});
});
@@ -66,7 +66,7 @@ describe('req.hostname', () => {
req.app.proxy = true;
req.header['x-forwarded-host'] = 'bar.com, baz.com';
req.header.host = 'foo.com';
- assert.equal(req.hostname, 'bar.com');
+ assert.strictEqual(req.hostname, 'bar.com');
});
});
});
diff --git a/test/request/href.js b/test/request/href.js
index ded3e8015..157ac9141 100644
--- a/test/request/href.js
+++ b/test/request/href.js
@@ -19,10 +19,10 @@ describe('ctx.href', () => {
__proto__: Stream.Readable.prototype
};
const ctx = context(req);
- assert.equal(ctx.href, 'http://localhost/users/1?next=/dashboard');
+ assert.strictEqual(ctx.href, 'http://localhost/users/1?next=/dashboard');
// change it also work
ctx.url = '/foo/users/1?next=/dashboard';
- assert.equal(ctx.href, 'http://localhost/users/1?next=/dashboard');
+ assert.strictEqual(ctx.href, 'http://localhost/users/1?next=/dashboard');
});
it('should work with `GET http://example.com/foo`', done => {
@@ -37,12 +37,12 @@ describe('ctx.href', () => {
path: 'http://example.com/foo',
port: address.port
}, res => {
- assert.equal(res.statusCode, 200);
+ assert.strictEqual(res.statusCode, 200);
let buf = '';
res.setEncoding('utf8');
res.on('data', s => buf += s);
res.on('end', () => {
- assert.equal(buf, 'http://example.com/foo');
+ assert.strictEqual(buf, 'http://example.com/foo');
done();
});
});
diff --git a/test/request/idempotent.js b/test/request/idempotent.js
index 230da031b..eaddaaed5 100644
--- a/test/request/idempotent.js
+++ b/test/request/idempotent.js
@@ -11,7 +11,7 @@ describe('ctx.idempotent', () => {
function check(method){
const req = request();
req.method = method;
- assert.equal(req.idempotent, true);
+ assert.strictEqual(req.idempotent, true);
}
});
});
@@ -20,7 +20,7 @@ describe('ctx.idempotent', () => {
it('should return false', () => {
const req = request();
req.method = 'POST';
- assert.equal(req.idempotent, false);
+ assert.strictEqual(req.idempotent, false);
});
});
});
diff --git a/test/request/ip.js b/test/request/ip.js
index 3375f700b..4ecd27ce2 100644
--- a/test/request/ip.js
+++ b/test/request/ip.js
@@ -15,7 +15,7 @@ describe('req.ip', () => {
req.headers['x-forwarded-for'] = '127.0.0.1';
req.socket.remoteAddress = '127.0.0.2';
const request = Request(req, undefined, app);
- assert.equal(request.ip, '127.0.0.1');
+ assert.strictEqual(request.ip, '127.0.0.1');
});
});
@@ -24,7 +24,7 @@ describe('req.ip', () => {
const req = { socket: new Stream.Duplex() };
req.socket.remoteAddress = '127.0.0.2';
const request = Request(req);
- assert.equal(request.ip, '127.0.0.2');
+ assert.strictEqual(request.ip, '127.0.0.2');
});
describe('with req.socket.remoteAddress not present', () => {
@@ -34,7 +34,7 @@ describe('req.ip', () => {
get: () => undefined, // So that the helper doesn't override it with a reasonable value
set: () => {}
});
- assert.equal(Request({ socket }).ip, '');
+ assert.strictEqual(Request({ socket }).ip, '');
});
});
});
@@ -43,17 +43,17 @@ describe('req.ip', () => {
const req = { socket: new Stream.Duplex() };
req.socket.remoteAddress = '127.0.0.2';
const request = Request(req);
- assert.equal(request.ip, '127.0.0.2');
+ assert.strictEqual(request.ip, '127.0.0.2');
req.socket.remoteAddress = '127.0.0.1';
- assert.equal(request.ip, '127.0.0.2');
+ assert.strictEqual(request.ip, '127.0.0.2');
});
it('should reset ip work', () => {
const req = { socket: new Stream.Duplex() };
req.socket.remoteAddress = '127.0.0.2';
const request = Request(req);
- assert.equal(request.ip, '127.0.0.2');
+ assert.strictEqual(request.ip, '127.0.0.2');
request.ip = '127.0.0.1';
- assert.equal(request.ip, '127.0.0.1');
+ assert.strictEqual(request.ip, '127.0.0.1');
});
});
diff --git a/test/request/is.js b/test/request/is.js
index 1db40c796..274ca0c39 100644
--- a/test/request/is.js
+++ b/test/request/is.js
@@ -10,16 +10,16 @@ describe('ctx.is(type)', () => {
ctx.header['content-type'] = 'text/html; charset=utf-8';
ctx.header['transfer-encoding'] = 'chunked';
- assert.equal(ctx.is('text/*'), 'text/html');
+ assert.strictEqual(ctx.is('text/*'), 'text/html');
});
describe('when no body is given', () => {
it('should return null', () => {
const ctx = context();
- assert.equal(ctx.is(), null);
- assert.equal(ctx.is('image/*'), null);
- assert.equal(ctx.is('image/*', 'text/*'), null);
+ assert.strictEqual(ctx.is(), null);
+ assert.strictEqual(ctx.is('image/*'), null);
+ assert.strictEqual(ctx.is('image/*', 'text/*'), null);
});
});
@@ -28,9 +28,9 @@ describe('ctx.is(type)', () => {
const ctx = context();
ctx.header['transfer-encoding'] = 'chunked';
- assert.equal(ctx.is(), false);
- assert.equal(ctx.is('image/*'), false);
- assert.equal(ctx.is('text/*', 'image/*'), false);
+ assert.strictEqual(ctx.is(), false);
+ assert.strictEqual(ctx.is('image/*'), false);
+ assert.strictEqual(ctx.is('text/*', 'image/*'), false);
});
});
@@ -40,7 +40,7 @@ describe('ctx.is(type)', () => {
ctx.header['content-type'] = 'image/png';
ctx.header['transfer-encoding'] = 'chunked';
- assert.equal(ctx.is(), 'image/png');
+ assert.strictEqual(ctx.is(), 'image/png');
});
});
@@ -50,17 +50,17 @@ describe('ctx.is(type)', () => {
ctx.header['content-type'] = 'image/png';
ctx.header['transfer-encoding'] = 'chunked';
- assert.equal(ctx.is('png'), 'png');
- assert.equal(ctx.is('.png'), '.png');
- assert.equal(ctx.is('image/png'), 'image/png');
- assert.equal(ctx.is('image/*'), 'image/png');
- assert.equal(ctx.is('*/png'), 'image/png');
-
- assert.equal(ctx.is('jpeg'), false);
- assert.equal(ctx.is('.jpeg'), false);
- assert.equal(ctx.is('image/jpeg'), false);
- assert.equal(ctx.is('text/*'), false);
- assert.equal(ctx.is('*/jpeg'), false);
+ assert.strictEqual(ctx.is('png'), 'png');
+ assert.strictEqual(ctx.is('.png'), '.png');
+ assert.strictEqual(ctx.is('image/png'), 'image/png');
+ assert.strictEqual(ctx.is('image/*'), 'image/png');
+ assert.strictEqual(ctx.is('*/png'), 'image/png');
+
+ assert.strictEqual(ctx.is('jpeg'), false);
+ assert.strictEqual(ctx.is('.jpeg'), false);
+ assert.strictEqual(ctx.is('image/jpeg'), false);
+ assert.strictEqual(ctx.is('text/*'), false);
+ assert.strictEqual(ctx.is('*/jpeg'), false);
});
});
@@ -70,22 +70,22 @@ describe('ctx.is(type)', () => {
ctx.header['content-type'] = 'image/png';
ctx.header['transfer-encoding'] = 'chunked';
- assert.equal(ctx.is('png'), 'png');
- assert.equal(ctx.is('.png'), '.png');
- assert.equal(ctx.is('text/*', 'image/*'), 'image/png');
- assert.equal(ctx.is('image/*', 'text/*'), 'image/png');
- assert.equal(ctx.is('image/*', 'image/png'), 'image/png');
- assert.equal(ctx.is('image/png', 'image/*'), 'image/png');
-
- assert.equal(ctx.is(['text/*', 'image/*']), 'image/png');
- assert.equal(ctx.is(['image/*', 'text/*']), 'image/png');
- assert.equal(ctx.is(['image/*', 'image/png']), 'image/png');
- assert.equal(ctx.is(['image/png', 'image/*']), 'image/png');
-
- assert.equal(ctx.is('jpeg'), false);
- assert.equal(ctx.is('.jpeg'), false);
- assert.equal(ctx.is('text/*', 'application/*'), false);
- assert.equal(ctx.is('text/html', 'text/plain', 'application/json; charset=utf-8'), false);
+ assert.strictEqual(ctx.is('png'), 'png');
+ assert.strictEqual(ctx.is('.png'), '.png');
+ assert.strictEqual(ctx.is('text/*', 'image/*'), 'image/png');
+ assert.strictEqual(ctx.is('image/*', 'text/*'), 'image/png');
+ assert.strictEqual(ctx.is('image/*', 'image/png'), 'image/png');
+ assert.strictEqual(ctx.is('image/png', 'image/*'), 'image/png');
+
+ assert.strictEqual(ctx.is(['text/*', 'image/*']), 'image/png');
+ assert.strictEqual(ctx.is(['image/*', 'text/*']), 'image/png');
+ assert.strictEqual(ctx.is(['image/*', 'image/png']), 'image/png');
+ assert.strictEqual(ctx.is(['image/png', 'image/*']), 'image/png');
+
+ assert.strictEqual(ctx.is('jpeg'), false);
+ assert.strictEqual(ctx.is('.jpeg'), false);
+ assert.strictEqual(ctx.is('text/*', 'application/*'), false);
+ assert.strictEqual(ctx.is('text/html', 'text/plain', 'application/json; charset=utf-8'), false);
});
});
@@ -95,9 +95,9 @@ describe('ctx.is(type)', () => {
ctx.header['content-type'] = 'application/x-www-form-urlencoded';
ctx.header['transfer-encoding'] = 'chunked';
- assert.equal(ctx.is('urlencoded'), 'urlencoded');
- assert.equal(ctx.is('json', 'urlencoded'), 'urlencoded');
- assert.equal(ctx.is('urlencoded', 'json'), 'urlencoded');
+ assert.strictEqual(ctx.is('urlencoded'), 'urlencoded');
+ assert.strictEqual(ctx.is('json', 'urlencoded'), 'urlencoded');
+ assert.strictEqual(ctx.is('urlencoded', 'json'), 'urlencoded');
});
});
});
diff --git a/test/request/length.js b/test/request/length.js
index 445ecd9e2..901dfa4ea 100644
--- a/test/request/length.js
+++ b/test/request/length.js
@@ -8,11 +8,11 @@ describe('ctx.length', () => {
it('should return length in content-length', () => {
const req = request();
req.header['content-length'] = '10';
- assert.equal(req.length, 10);
+ assert.strictEqual(req.length, 10);
});
it('should return undefined with no content-length present', () => {
const req = request();
- assert.equal(req.length, undefined);
+ assert.strictEqual(req.length, undefined);
});
});
diff --git a/test/request/origin.js b/test/request/origin.js
index b510b3ef4..886ae9d11 100644
--- a/test/request/origin.js
+++ b/test/request/origin.js
@@ -17,9 +17,9 @@ describe('ctx.origin', () => {
__proto__: Stream.Readable.prototype
};
const ctx = context(req);
- assert.equal(ctx.origin, 'http://localhost');
+ assert.strictEqual(ctx.origin, 'http://localhost');
// change it also work
ctx.url = '/foo/users/1?next=/dashboard';
- assert.equal(ctx.origin, 'http://localhost');
+ assert.strictEqual(ctx.origin, 'http://localhost');
});
});
diff --git a/test/request/path.js b/test/request/path.js
index e432a30d5..7afae0498 100644
--- a/test/request/path.js
+++ b/test/request/path.js
@@ -9,7 +9,7 @@ describe('ctx.path', () => {
it('should return the pathname', () => {
const ctx = context();
ctx.url = '/login?next=/dashboard';
- assert.equal(ctx.path, '/login');
+ assert.strictEqual(ctx.path, '/login');
});
});
@@ -19,22 +19,22 @@ describe('ctx.path=', () => {
ctx.url = '/login?next=/dashboard';
ctx.path = '/logout';
- assert.equal(ctx.path, '/logout');
- assert.equal(ctx.url, '/logout?next=/dashboard');
+ assert.strictEqual(ctx.path, '/logout');
+ assert.strictEqual(ctx.url, '/logout?next=/dashboard');
});
it('should change .url but not .originalUrl', () => {
const ctx = context({ url: '/login' });
ctx.path = '/logout';
- assert.equal(ctx.url, '/logout');
- assert.equal(ctx.originalUrl, '/login');
- assert.equal(ctx.request.originalUrl, '/login');
+ assert.strictEqual(ctx.url, '/logout');
+ assert.strictEqual(ctx.originalUrl, '/login');
+ assert.strictEqual(ctx.request.originalUrl, '/login');
});
it('should not affect parseurl', () => {
const ctx = context({ url: '/login?foo=bar' });
ctx.path = '/login';
const url = parseurl(ctx.req);
- assert.equal(url.path, '/login?foo=bar');
+ assert.strictEqual(url.path, '/login?foo=bar');
});
});
diff --git a/test/request/protocol.js b/test/request/protocol.js
index 04d507920..b2acc53ef 100644
--- a/test/request/protocol.js
+++ b/test/request/protocol.js
@@ -9,7 +9,7 @@ describe('req.protocol', () => {
it('should return "https"', () => {
const req = request();
req.req.socket = { encrypted: true };
- assert.equal(req.protocol, 'https');
+ assert.strictEqual(req.protocol, 'https');
});
});
@@ -17,7 +17,7 @@ describe('req.protocol', () => {
it('should return "http"', () => {
const req = request();
req.req.socket = {};
- assert.equal(req.protocol, 'http');
+ assert.strictEqual(req.protocol, 'http');
});
});
@@ -28,7 +28,7 @@ describe('req.protocol', () => {
req.app.proxy = true;
req.req.socket = {};
req.header['x-forwarded-proto'] = 'https, http';
- assert.equal(req.protocol, 'https');
+ assert.strictEqual(req.protocol, 'https');
});
describe('and X-Forwarded-Proto is empty', () => {
@@ -37,7 +37,7 @@ describe('req.protocol', () => {
req.app.proxy = true;
req.req.socket = {};
req.header['x-forwarded-proto'] = '';
- assert.equal(req.protocol, 'http');
+ assert.strictEqual(req.protocol, 'http');
});
});
});
@@ -47,7 +47,7 @@ describe('req.protocol', () => {
const req = request();
req.req.socket = {};
req.header['x-forwarded-proto'] = 'https, http';
- assert.equal(req.protocol, 'http');
+ assert.strictEqual(req.protocol, 'http');
});
});
});
diff --git a/test/request/query.js b/test/request/query.js
index 217f98bf1..6b8eecd36 100644
--- a/test/request/query.js
+++ b/test/request/query.js
@@ -14,13 +14,13 @@ describe('ctx.query', () => {
it('should return the same object each time it\'s accessed', () => {
const ctx = context({ url: '/' });
ctx.query.a = '2';
- assert.equal(ctx.query.a, '2');
+ assert.strictEqual(ctx.query.a, '2');
});
});
it('should return a parsed query string', () => {
const ctx = context({ url: '/?page=2' });
- assert.equal(ctx.query.page, '2');
+ assert.strictEqual(ctx.query.page, '2');
});
});
@@ -28,16 +28,16 @@ describe('ctx.query=', () => {
it('should stringify and replace the query string and search', () => {
const ctx = context({ url: '/store/shoes' });
ctx.query = { page: 2, color: 'blue' };
- assert.equal(ctx.url, '/store/shoes?page=2&color=blue');
- assert.equal(ctx.querystring, 'page=2&color=blue');
- assert.equal(ctx.search, '?page=2&color=blue');
+ assert.strictEqual(ctx.url, '/store/shoes?page=2&color=blue');
+ assert.strictEqual(ctx.querystring, 'page=2&color=blue');
+ assert.strictEqual(ctx.search, '?page=2&color=blue');
});
it('should change .url but not .originalUrl', () => {
const ctx = context({ url: '/store/shoes' });
ctx.query = { page: 2 };
- assert.equal(ctx.url, '/store/shoes?page=2');
- assert.equal(ctx.originalUrl, '/store/shoes');
- assert.equal(ctx.request.originalUrl, '/store/shoes');
+ assert.strictEqual(ctx.url, '/store/shoes?page=2');
+ assert.strictEqual(ctx.originalUrl, '/store/shoes');
+ assert.strictEqual(ctx.request.originalUrl, '/store/shoes');
});
});
diff --git a/test/request/querystring.js b/test/request/querystring.js
index 13287c16f..e2bbb6930 100644
--- a/test/request/querystring.js
+++ b/test/request/querystring.js
@@ -8,14 +8,14 @@ const parseurl = require('parseurl');
describe('ctx.querystring', () => {
it('should return the querystring', () => {
const ctx = context({ url: '/store/shoes?page=2&color=blue' });
- assert.equal(ctx.querystring, 'page=2&color=blue');
+ assert.strictEqual(ctx.querystring, 'page=2&color=blue');
});
describe('when ctx.req not present', () => {
it('should return an empty string', () => {
const ctx = context();
ctx.request.req = null;
- assert.equal(ctx.querystring, '');
+ assert.strictEqual(ctx.querystring, '');
});
});
});
@@ -24,31 +24,31 @@ describe('ctx.querystring=', () => {
it('should replace the querystring', () => {
const ctx = context({ url: '/store/shoes' });
ctx.querystring = 'page=2&color=blue';
- assert.equal(ctx.url, '/store/shoes?page=2&color=blue');
- assert.equal(ctx.querystring, 'page=2&color=blue');
+ assert.strictEqual(ctx.url, '/store/shoes?page=2&color=blue');
+ assert.strictEqual(ctx.querystring, 'page=2&color=blue');
});
it('should update ctx.search and ctx.query', () => {
const ctx = context({ url: '/store/shoes' });
ctx.querystring = 'page=2&color=blue';
- assert.equal(ctx.url, '/store/shoes?page=2&color=blue');
- assert.equal(ctx.search, '?page=2&color=blue');
- assert.equal(ctx.query.page, '2');
- assert.equal(ctx.query.color, 'blue');
+ assert.strictEqual(ctx.url, '/store/shoes?page=2&color=blue');
+ assert.strictEqual(ctx.search, '?page=2&color=blue');
+ assert.strictEqual(ctx.query.page, '2');
+ assert.strictEqual(ctx.query.color, 'blue');
});
it('should change .url but not .originalUrl', () => {
const ctx = context({ url: '/store/shoes' });
ctx.querystring = 'page=2&color=blue';
- assert.equal(ctx.url, '/store/shoes?page=2&color=blue');
- assert.equal(ctx.originalUrl, '/store/shoes');
- assert.equal(ctx.request.originalUrl, '/store/shoes');
+ assert.strictEqual(ctx.url, '/store/shoes?page=2&color=blue');
+ assert.strictEqual(ctx.originalUrl, '/store/shoes');
+ assert.strictEqual(ctx.request.originalUrl, '/store/shoes');
});
it('should not affect parseurl', () => {
const ctx = context({ url: '/login?foo=bar' });
ctx.querystring = 'foo=bar';
const url = parseurl(ctx.req);
- assert.equal(url.path, '/login?foo=bar');
+ assert.strictEqual(url.path, '/login?foo=bar');
});
});
diff --git a/test/request/search.js b/test/request/search.js
index 3efb66545..eaefeb0f7 100644
--- a/test/request/search.js
+++ b/test/request/search.js
@@ -8,31 +8,31 @@ describe('ctx.search=', () => {
it('should replace the search', () => {
const ctx = context({ url: '/store/shoes' });
ctx.search = '?page=2&color=blue';
- assert.equal(ctx.url, '/store/shoes?page=2&color=blue');
- assert.equal(ctx.search, '?page=2&color=blue');
+ assert.strictEqual(ctx.url, '/store/shoes?page=2&color=blue');
+ assert.strictEqual(ctx.search, '?page=2&color=blue');
});
it('should update ctx.querystring and ctx.query', () => {
const ctx = context({ url: '/store/shoes' });
ctx.search = '?page=2&color=blue';
- assert.equal(ctx.url, '/store/shoes?page=2&color=blue');
- assert.equal(ctx.querystring, 'page=2&color=blue');
- assert.equal(ctx.query.page, '2');
- assert.equal(ctx.query.color, 'blue');
+ assert.strictEqual(ctx.url, '/store/shoes?page=2&color=blue');
+ assert.strictEqual(ctx.querystring, 'page=2&color=blue');
+ assert.strictEqual(ctx.query.page, '2');
+ assert.strictEqual(ctx.query.color, 'blue');
});
it('should change .url but not .originalUrl', () => {
const ctx = context({ url: '/store/shoes' });
ctx.search = '?page=2&color=blue';
- assert.equal(ctx.url, '/store/shoes?page=2&color=blue');
- assert.equal(ctx.originalUrl, '/store/shoes');
- assert.equal(ctx.request.originalUrl, '/store/shoes');
+ assert.strictEqual(ctx.url, '/store/shoes?page=2&color=blue');
+ assert.strictEqual(ctx.originalUrl, '/store/shoes');
+ assert.strictEqual(ctx.request.originalUrl, '/store/shoes');
});
describe('when missing', () => {
it('should return ""', () => {
const ctx = context({ url: '/store/shoes' });
- assert.equal(ctx.search, '');
+ assert.strictEqual(ctx.search, '');
});
});
});
diff --git a/test/request/secure.js b/test/request/secure.js
index aca7ebdd2..2eaf1dabe 100644
--- a/test/request/secure.js
+++ b/test/request/secure.js
@@ -8,6 +8,6 @@ describe('req.secure', () => {
it('should return true when encrypted', () => {
const req = request();
req.req.socket = { encrypted: true };
- assert.equal(req.secure, true);
+ assert.strictEqual(req.secure, true);
});
});
diff --git a/test/request/stale.js b/test/request/stale.js
index e7b1c3cc3..be41500f8 100644
--- a/test/request/stale.js
+++ b/test/request/stale.js
@@ -11,7 +11,7 @@ describe('req.stale', () => {
ctx.method = 'GET';
ctx.req.headers['if-none-match'] = '"123"';
ctx.set('ETag', '"123"');
- assert.equal(ctx.fresh, true);
- assert.equal(ctx.stale, false);
+ assert.strictEqual(ctx.fresh, true);
+ assert.strictEqual(ctx.stale, false);
});
});
diff --git a/test/request/type.js b/test/request/type.js
index 625ee8333..6927d6d25 100644
--- a/test/request/type.js
+++ b/test/request/type.js
@@ -8,11 +8,11 @@ describe('req.type', () => {
it('should return type void of parameters', () => {
const req = request();
req.header['content-type'] = 'text/html; charset=utf-8';
- assert.equal(req.type, 'text/html');
+ assert.strictEqual(req.type, 'text/html');
});
it('should return empty string with no host present', () => {
const req = request();
- assert.equal(req.type, '');
+ assert.strictEqual(req.type, '');
});
});
diff --git a/test/response/append.js b/test/response/append.js
index e40bd7515..0e9c4a0ba 100644
--- a/test/response/append.js
+++ b/test/response/append.js
@@ -28,7 +28,7 @@ describe('ctx.append(name, val)', () => {
ctx.set('Link', '