blob: 50017980dc11418103be57243ecc8e7aeccf46f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import { describe, expect, it } from 'vitest';
import { withDefaultOnError } from './defaults';
describe('defaults util', () => {
describe('withDefaultOnError', () => {
it('should return the callback or the default one if the callback throws', () => {
expect(withDefaultOnError(() => 'original', 'default')).to.eql('original');
});
expect(
withDefaultOnError(() => {
throw new Error('message');
}, 'default'),
).to.eql('default');
});
});
|