Skip to content

Commit

Permalink
Tests (#79-2)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Aug 8, 2024
1 parent ff5d280 commit 1bc0473
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/util/assertUtil.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { describe, it, expect } from 'vitest';
import { assertDefined } from './assertUtil';

// Example function tests
describe('assertDefined', () => {
it.each([{}, 'test', 999, true, false, new Date()])(
'should not throw if value is defined: %s',
value => {
assertDefined(value, 'value');
expect(true).toBe(true);
}
);

it.each([null, undefined])(
'should throw an error for null or undefined values: %s',
value => {
expect(() => assertDefined(value, 'value')).toThrow(
`'value' is required`
);
}
);
});

0 comments on commit 1bc0473

Please sign in to comment.