@oada/oadaify
Version:
Make OADA data nicer to work with in JS/TS
52 lines • 1.47 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Tests for working with JSON primitives
*
* @packageDocumentation
*/
const ava_1 = __importDefault(require("ava"));
const ts_expect_1 = require("ts-expect");
const __1 = require("../");
ava_1.default('Should work with strings', (t) => {
const s = __1.oadaify('foobar');
ts_expect_1.expectType(s);
t.is(s, 'foobar');
});
// Check falsy
ava_1.default('Should work with empty string', (t) => {
const se = __1.oadaify('');
ts_expect_1.expectType(se);
t.is(se, '');
});
ava_1.default('Should work with numbers', (t) => {
const n = __1.oadaify(1);
ts_expect_1.expectType(n);
t.is(n, 1);
});
// Check falsy
ava_1.default('Should work with 0', (t) => {
const nz = __1.oadaify(0);
ts_expect_1.expectType(nz);
t.is(nz, 0);
});
ava_1.default('Should work with true', (t) => {
const b = __1.oadaify(true);
ts_expect_1.expectType(b);
t.is(b, true);
});
ava_1.default('Should work with false', (t) => {
const bf = __1.oadaify(false);
ts_expect_1.expectType(bf);
t.is(bf, false);
});
// Check falsy
ava_1.default('Should work with null', (t) => {
const nil = __1.oadaify(null);
ts_expect_1.expectType(nil);
t.is(nil, null);
});
//# sourceMappingURL=primitives.spec.js.map