1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 | const assert = require("assert");
|
20 | const mocha_1 = require("mocha");
|
21 | const index_1 = require("../index");
|
22 | mocha_1.describe('#toBooleanSafe()', function () {
|
23 | mocha_1.describe('(null)', function () {
|
24 | mocha_1.it('should return (false) when the value is (null)', function () {
|
25 | const RES = index_1.toBooleanSafe(null);
|
26 | assert.ok('boolean' === typeof RES);
|
27 | assert.equal(RES, false);
|
28 | assert.strictEqual(RES, false);
|
29 | });
|
30 | mocha_1.it('should return (true) when the value is (null)', function () {
|
31 | const RES = index_1.toBooleanSafe(null, true);
|
32 | assert.ok('boolean' === typeof RES);
|
33 | assert.equal(RES, true);
|
34 | assert.strictEqual(RES, true);
|
35 | });
|
36 | });
|
37 | mocha_1.describe('(undefined)', function () {
|
38 | mocha_1.it('should return (false) when the value is (null)', function () {
|
39 | const RES = index_1.toBooleanSafe(undefined);
|
40 | assert.ok('boolean' === typeof RES);
|
41 | assert.equal(RES, false);
|
42 | assert.strictEqual(RES, false);
|
43 | });
|
44 | mocha_1.it('should return (true) when the value is (null)', function () {
|
45 | const RES = index_1.toBooleanSafe(undefined, true);
|
46 | assert.ok('boolean' === typeof RES);
|
47 | assert.equal(RES, true);
|
48 | assert.strictEqual(RES, true);
|
49 | });
|
50 | });
|
51 | mocha_1.describe('(true)', function () {
|
52 | mocha_1.it('should return (true)', function () {
|
53 | const RES = index_1.toBooleanSafe(true);
|
54 | assert.ok('boolean' === typeof RES);
|
55 | assert.equal(RES, true);
|
56 | assert.strictEqual(RES, true);
|
57 | });
|
58 | mocha_1.it('should return (true)', function () {
|
59 | const RES = index_1.toBooleanSafe(true, false);
|
60 | assert.ok('boolean' === typeof RES);
|
61 | assert.equal(RES, true);
|
62 | assert.strictEqual(RES, true);
|
63 | });
|
64 | });
|
65 | mocha_1.describe('(true)', function () {
|
66 | mocha_1.it('should return (false)', function () {
|
67 | const RES = index_1.toBooleanSafe(false);
|
68 | assert.ok('boolean' === typeof RES);
|
69 | assert.equal(RES, false);
|
70 | assert.strictEqual(RES, false);
|
71 | });
|
72 | mocha_1.it('should return (false)', function () {
|
73 | const RES = index_1.toBooleanSafe(false, true);
|
74 | assert.ok('boolean' === typeof RES);
|
75 | assert.equal(RES, false);
|
76 | assert.strictEqual(RES, false);
|
77 | });
|
78 | });
|
79 | });
|
80 |
|
\ | No newline at end of file |