embedded-trainings-2020/down-the-stack-book/node_modules/@kazumatu981/markdown-it-kroki/tests/unittest/conract.test.js
Jonathan Pallant (Ferrous Systems) a4ee38540d
Ensure marp can render slides.
We bundle markdown-it-kroki, which can add mermaid diagrams to marp slides using https://kroki.io.
2023-03-22 10:28:51 +00:00

35 lines
1.2 KiB
JavaScript

const expect = require('chai').expect;
const contract = require('../../lib/contract');
describe('# [unit test]: contract.js', () => {
describe('## toNonEmptyString()', () => {
['abc', ' ', ' abc '].forEach((test) => {
it(`* normal cases. { testcase: ${test} }`, () => {
expect(() => {
contract.toNonEmptyString(test);
}).not.to.throw();
})
});
['', null, undefined, 123, 0.123, true, { test: 123 }].forEach((test) => {
it(`* abnormal cases. { testcase: ${test} }`, () => {
expect(() => {
contract.toNonEmptyString(test);
}).to.throw();
})
});
});
describe('## toTrue', () => {
it('* normal case. {test case: true}', () => {
expect(() => {
contract.toTrue(true);
}).not.to.throw();
});
['', null, undefined, 123, 0.123, false, { test: 123 }].forEach((test) => {
it(`* abnormal cases. { testcase: ${test} }`, () => {
expect(() => {
contract.toTrue(test);
}).to.throw();
})
});
});
})