UNPKG

cybernaut

Version:

Reliable, zero configuration end-to-end testing in BDD-style.

35 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const ava_1 = require("ava"); const description_1 = require("../description"); ava_1.default('`format` should return a formatted string', (t) => tslib_1.__awaiter(this, void 0, void 0, function* () { t.plan(5); t.is(description_1.format({ template: '' }), ''); t.is(description_1.format({ template: '', args: [] }), ''); t.is(description_1.format({ template: '{} {} {} {} {}', args: [true, 1, '', null, undefined] }), 'true 1 \'\' null undefined'); t.is(description_1.format({ template: '{}', args: [[null, undefined]] }), '[ null, undefined ]'); t.is(description_1.format({ template: '{}', args: [{ null: null, undefined }] }), '{ null: null, undefined: undefined }'); })); ava_1.default('`format` should throw an error', (t) => tslib_1.__awaiter(this, void 0, void 0, function* () { t.plan(4); t.throws(() => { description_1.format({ template: '{}' }); }, 'Missing format argument'); t.throws(() => { description_1.format({ template: '{}', args: [] }); }, 'Missing format argument'); t.throws(() => { description_1.format({ template: '', args: [null] }); }, 'Superfluous format argument'); t.throws(() => { description_1.format({ template: '{}', args: [null, undefined] }); }, 'Superfluous format argument'); })); //# sourceMappingURL=description.test.js.map