refactor(validation): simplified validation management with helpers

This commit is contained in:
Corentin Thomasset 2022-08-04 21:59:48 +02:00
parent b38ab82d05
commit f54223fb0a
No known key found for this signature in database
GPG key ID: 3103EB5E79496F9C
5 changed files with 35 additions and 39 deletions

15
src/utils/boolean.test.ts Normal file
View file

@ -0,0 +1,15 @@
import { describe, expect, it } from 'vitest';
import { isNotThrowing } from './boolean';
describe('boolean utils', () => {
describe('isNotThrowing', () => {
it('should return if the call throws or false otherwise', () => {
expect(isNotThrowing(() => {})).to.eql(true);
expect(
isNotThrowing(() => {
throw new Error();
}),
).to.eql(false);
});
});
});