1 |
|
2 |
|
3 | var helper = require('../lib/helper')
|
4 | , should = require('chai').should()
|
5 | ;
|
6 |
|
7 | describe('helper.isSomething()', function(){
|
8 | it('should return true on non-empty strings', function(){
|
9 | helper.isSomething('something').should.be.true;
|
10 | helper.isSomething('').should.be.false;
|
11 | });
|
12 |
|
13 | it('should return false on null and undefined', function(){
|
14 | helper.isSomething(null).should.be.false;
|
15 | helper.isSomething(undefined).should.be.false;
|
16 | });
|
17 |
|
18 | it('should return true on numbers', function() {
|
19 | helper.isSomething(0).should.be.true;
|
20 | helper.isSomething(-1).should.be.true;
|
21 | });
|
22 |
|
23 | it('should return true on other boolean values', function(){
|
24 | helper.isSomething(false).should.be.true;
|
25 | helper.isSomething(true).should.be.true;
|
26 | });
|
27 |
|
28 | it('should return true on non-empty arrays', function(){
|
29 | helper.isSomething([1,2,3]).should.be.true;
|
30 | helper.isSomething([]).should.be.false;
|
31 | });
|
32 |
|
33 | it('should return true on non-empty objects', function(){
|
34 | helper.isSomething({x:'1'}).should.be.true;
|
35 | helper.isSomething({}).should.be.false;
|
36 | });
|
37 | });
|