strict_filters/strict_variables when creating engine

This commit is contained in:
harttle
2016-11-07 00:01:02 +08:00
parent 1e7873afc0
commit ddd06e12b5
8 changed files with 203 additions and 90 deletions
+47 -2
View File
@@ -11,7 +11,7 @@ describe('util/underscore', function() {
expect(_.isString('foo')).to.be.true;
});
it('should return true String instance', function() {
expect(_.isString(new String('foo'))).to.be.true;
expect(_.isString(String('foo'))).to.be.true;
});
it('should return false for 123 ', function() {
expect(_.isString(123)).to.be.false;
@@ -53,7 +53,7 @@ describe('util/underscore', function() {
expect(_.isArray("foo")).to.be.false;
});
});
describe('.echo()', function(){
describe('.echo()', function() {
it('should be transparent', function() {
expect(_.echo('foo')('bar')).to.equal('bar');
});
@@ -63,4 +63,49 @@ describe('util/underscore', function() {
expect(log).to.have.been.calledWith('[foo]', 'bar');
});
});
describe('.assign()', function() {
it('should handle null dst', function() {
expect(_.assign(null, {
foo: 'bar'
})).to.deep.equal({
foo: 'bar'
});
});
it('should assign 2 objects', function() {
var src = {
foo: 'foo',
bar: 'bar'
};
var dst = {
foo: 'bar',
kaa: 'kaa'
};
expect(_.assign(dst, src)).to.deep.equal({
foo: 'foo',
bar: 'bar',
kaa: 'kaa'
});
});
it('should assign 3 objects', function() {
expect(_.assign({
foo: 'foo'
}, {
bar: 'bar'
}, {
car: 'car'
})).to.deep.equal({
foo: 'foo',
bar: 'bar',
car: 'car'
});
});
});
describe('.uniq()', function() {
it('should handle empty array', function() {
expect(_.uniq([])).to.deep.equal([]);
});
it('should do uniq', function() {
expect(_.uniq([1, 'a', 'a', 1])).to.deep.equal([1, 'a']);
});
});
});