- import { describe, it, expect } from 'vitest';
- import { add } from '../src';
-
- describe('core', () => {
- it('returns result', () => {
- expect(add({ a: 1, b: 1 })).toEqual(2);
- });
-
- it('throws when given invalid argument types', () => {
- expect(() => add({ a: '1' as unknown as number, b: 1 })).toThrow(TypeError);
- });
-
- it('throws when given out-of-range arguments', () => {
- expect(() => add({ a: Infinity, b: 1 })).toThrow(RangeError);
- });
- });
|