koa-lite/test/application/inspect.js
Ruben Bridgewater 8f047ddb84 fix: use non deprecated custom inspect (#1198)
Custom inspection with the `inspect` property is deprecated and will
not work in Node.js 11 anymore. This fixes it by using the custom
inspect symbol where existent and falls back to the old style in case
it does not exist.
2018-06-25 10:34:15 +08:00

21 lines
482 B
JavaScript

'use strict';
const assert = require('assert');
const util = require('util');
const Koa = require('../..');
const app = new Koa();
describe('app.inspect()', () => {
it('should work', () => {
const str = util.inspect(app);
assert.equal("{ subdomainOffset: 2, proxy: false, env: 'test' }", str);
});
it('should return a json representation', () => {
assert.deepEqual(
{ subdomainOffset: 2, proxy: false, env: 'test' },
app.inspect()
);
});
});