mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
test(RelayError): code coverage 100.00%
This commit is contained in:
parent
85a6089e36
commit
f5ee5ea6a3
1 changed files with 23 additions and 0 deletions
23
src/RelayError.test.ts
Normal file
23
src/RelayError.test.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { assertThrows } from '@std/assert';
|
||||||
|
|
||||||
|
import { RelayError } from '@/RelayError.ts';
|
||||||
|
|
||||||
|
Deno.test('Construct a RelayError from the reason message', () => {
|
||||||
|
assertThrows(
|
||||||
|
() => {
|
||||||
|
throw RelayError.fromReason('duplicate: already exists');
|
||||||
|
},
|
||||||
|
RelayError,
|
||||||
|
'duplicate: already exists',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
Deno.test('Throw a new RelayError if the OK message is false', () => {
|
||||||
|
assertThrows(
|
||||||
|
() => {
|
||||||
|
RelayError.assert(['OK', 'yolo', false, 'error: bla bla bla']);
|
||||||
|
},
|
||||||
|
RelayError,
|
||||||
|
'error: bla bla bla',
|
||||||
|
);
|
||||||
|
});
|
||||||
Loading…
Add table
Reference in a new issue