koa-lite/test/context/inspect.js
Luke Bousfield 67630217ae Fix context.inspect when called on the prototype (#1012)
* Fix context.inspect when called on the prototype

Fixes #837

* Add tests
2017-07-15 20:05:26 -04:00

20 lines
536 B
JavaScript

'use strict';
const prototype = require('../../lib/context');
const assert = require('assert');
const context = require('../helpers/context');
describe('ctx.inspect()', () => {
it('should return a json representation', () => {
const ctx = context();
const toJSON = ctx.toJSON(ctx);
assert.deepEqual(toJSON, ctx.inspect());
});
// console.log(require.cache) will call prototype.inspect()
it('should not crash when called on the prototype', () => {
assert.deepEqual(prototype, prototype.inspect());
});
});