Permalink
Browse files

util, feat: add underscore test case.

  • Loading branch information...
xicilion committed Oct 17, 2017
1 parent ff90700 commit 6c625f5446a4b1393ec55745ded43467f328c832
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/util_test.js
View
@@ -369,6 +369,23 @@ describe('util', () => {
assert.deepEqual(o, o1);
o["a"] = 150;
assert.notDeepEqual(o, o1);
var moe = {
name: 'moe',
lucky: [13, 27, 34]
};
var clone = util.clone(moe);
assert.strictEqual(clone.name, 'moe', 'the clone as the attributes of the original');
clone.name = 'curly';
assert.ok(clone.name === 'curly' && moe.name === 'moe', 'clones can change shallow attributes without affecting the original');
clone.lucky.push(101);
assert.strictEqual(util.last(moe.lucky), 101, 'changes to deep attributes are shared with the original');
assert.strictEqual(util.clone(void 0), void 0, 'non objects should not be changed by clone');
assert.strictEqual(util.clone(1), 1, 'non objects should not be changed by clone');
assert.strictEqual(util.clone(null), null, 'non objects should not be changed by clone');
});
it('extend', () => {

0 comments on commit 6c625f5

Please sign in to comment.