2022-08-18 10:53:23 +02:00
|
|
|
import _ from 'lodash';
|
2022-08-04 21:59:48 +02:00
|
|
|
import { describe, expect, it } from 'vitest';
|
2023-05-01 16:43:45 +02:00
|
|
|
import { booleanToHumanReadable, isNotThrowing } from './boolean';
|
2022-08-04 21:59:48 +02:00
|
|
|
|
|
|
|
describe('boolean utils', () => {
|
|
|
|
describe('isNotThrowing', () => {
|
|
|
|
it('should return if the call throws or false otherwise', () => {
|
2022-08-18 10:53:23 +02:00
|
|
|
expect(isNotThrowing(_.noop)).to.eql(true);
|
2022-08-04 21:59:48 +02:00
|
|
|
expect(
|
|
|
|
isNotThrowing(() => {
|
2023-05-28 23:13:24 +02:00
|
|
|
throw new Error('message');
|
2022-08-04 21:59:48 +02:00
|
|
|
}),
|
|
|
|
).to.eql(false);
|
|
|
|
});
|
|
|
|
});
|
2023-05-01 16:43:45 +02:00
|
|
|
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|
2022-08-04 21:59:48 +02:00
|
|
|
});
|