feature: rich info error

This commit is contained in:
harttle
2016-11-09 01:58:49 +08:00
parent 295eee8134
commit 5c0209ec8b
12 changed files with 473 additions and 146 deletions
+17
View File
@@ -1,11 +1,28 @@
const chai = require("chai");
const sinon = require('sinon');
const expect = chai.expect;
const Errors = require('../../src/util/error.js');
chai.use(require("sinon-chai"));
var _ = require('../../src/util/underscore.js');
describe('util/underscore', function() {
describe('.isError()', function() {
it('should return true for new Error', function() {
expect(_.isError(new Error())).to.be.true;
});
it('should return true for RenderError', function() {
var tpl = {
token: {
input: 'xx'
}
};
expect(_.isError(new Errors.RenderError(new Error(), tpl))).to.be.true;
});
it('should return true for RenderBreakError', function() {
expect(_.isError(new Errors.RenderBreakError())).to.be.true;
});
});
describe('.isString()', function() {
it('should return true for literal string', function() {
expect(_.isString('foo')).to.be.true;