mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 05:47:10 -04:00
23 lines
718 B
TypeScript
23 lines
718 B
TypeScript
import _ from 'lodash';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { booleanToHumanReadable, isNotThrowing } from './boolean';
|
|
|
|
describe('boolean utils', () => {
|
|
describe('isNotThrowing', () => {
|
|
it('should return if the call throws or false otherwise', () => {
|
|
expect(isNotThrowing(_.noop)).to.eql(true);
|
|
expect(
|
|
isNotThrowing(() => {
|
|
throw new Error('message');
|
|
}),
|
|
).to.eql(false);
|
|
});
|
|
});
|
|
|
|
describe('booleanToHumanReadable', () => {
|
|
it('should return "Yes" if the value is true and "No" otherwise', () => {
|
|
expect(booleanToHumanReadable(true)).to.eql('Yes');
|
|
expect(booleanToHumanReadable(false)).to.eql('No');
|
|
});
|
|
});
|
|
});
|