diff options
author | Yaroslav De La Peña Smirnov <yaros.rus_89@live.com.mx> | 2017-11-29 11:44:34 +0300 |
---|---|---|
committer | Yaroslav De La Peña Smirnov <yaros.rus_89@live.com.mx> | 2017-11-29 11:44:34 +0300 |
commit | 67fdec20726e48ba3a934cb25bb30d47ec4a4f29 (patch) | |
tree | 37fd9f4f0b0c20103e1646fc83021e4765de3680 /node_modules/object-component/test | |
download | spanish-checkers-67fdec20726e48ba3a934cb25bb30d47ec4a4f29.tar.gz spanish-checkers-67fdec20726e48ba3a934cb25bb30d47ec4a4f29.zip |
Initial commit, version 0.5.3
Diffstat (limited to 'node_modules/object-component/test')
-rw-r--r-- | node_modules/object-component/test/object.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/node_modules/object-component/test/object.js b/node_modules/object-component/test/object.js new file mode 100644 index 0000000..23a7423 --- /dev/null +++ b/node_modules/object-component/test/object.js @@ -0,0 +1,48 @@ + +/** + * Module dependencies. + */ + +var object = require('..'); + +describe('.keys(obj)', function(){ + it('should return the keys of an object', function(){ + var obj = { name: 'tobi', age: 1 }; + object.keys(obj).should.eql(['name', 'age']); + }) +}) + +describe('.values(obj)', function(){ + it('should return the values of an object', function(){ + var obj = { name: 'tobi', age: 1 }; + object.values(obj).should.eql(['tobi', 1]); + }) +}) + +describe('.length(obj)', function(){ + it('should return key count', function(){ + var obj = { name: 'tobi', age: 1 }; + object.length(obj).should.equal(2); + }) +}) + +describe('.merge(a, b)', function(){ + it('should merge two objects', function(){ + var a = { foo: 'bar' }; + var b = { bar: 'baz' }; + object.merge(a, b).should.eql({ foo: 'bar', bar: 'baz' }); + }) + + it('should give precedence to b', function(){ + var a = { foo: 'bar' }; + var b = { foo: 'baz' }; + object.merge(a, b).should.eql({ foo: 'baz' }); + }) +}) + +describe('.isEmpty()', function(){ + it('should check if the object is empty', function(){ + object.isEmpty({}).should.be.true; + object.isEmpty({ foo: 'bar' }).should.be.false; + }) +})
\ No newline at end of file |