1 | 'use strict';
|
2 |
|
3 | var isNotEmpty = require('../src/notEmpty'),
|
4 | assert = require('chai').assert;
|
5 |
|
6 | describe('notEmpty', function() {
|
7 |
|
8 | it('checks if object has enumerable properties', function() {
|
9 | var objectWithoutPrototype = Object.create(null);
|
10 | objectWithoutPrototype.property = 'value';
|
11 |
|
12 | assert.ok(isNotEmpty({property: 'value'}));
|
13 | assert.ok(isNotEmpty(objectWithoutPrototype));
|
14 |
|
15 | assert.ok(!isNotEmpty({}));
|
16 | });
|
17 |
|
18 | it('checks if object is an array like object and got some values defined', function() {
|
19 | assert.ok(isNotEmpty({length: 1}));
|
20 | assert.ok(isNotEmpty([1, 2]));
|
21 |
|
22 | assert.ok(!isNotEmpty(arguments));
|
23 | assert.ok(!isNotEmpty([]));
|
24 | assert.ok(!isNotEmpty({length: 0}));
|
25 | });
|
26 |
|
27 | it('checks if object is not an empty string', function() {
|
28 | assert.ok(isNotEmpty(' '));
|
29 | assert.ok(isNotEmpty('value'));
|
30 |
|
31 | assert.ok(!isNotEmpty(''));
|
32 | });
|
33 |
|
34 | it('every other value is not empty', function() {
|
35 | assert.ok(isNotEmpty(0));
|
36 | assert.ok(isNotEmpty(false));
|
37 | assert.ok(isNotEmpty(100));
|
38 | });
|
39 | }); |
\ | No newline at end of file |