Skip to content

Commit

Permalink
Add tests for the assertIsError function
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudahtt committed Sep 26, 2023
1 parent 2532dce commit 498d6db
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/name-controller/src/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { graphQL } from './util';
import { assertIsError, graphQL } from './util';

describe('Utils', () => {
describe('graphQL', () => {
Expand Down Expand Up @@ -51,4 +51,16 @@ describe('Utils', () => {
);
});
});

describe('assertIsError', () => {
it('does not throw if given an error', () => {
expect(() => assertIsError(new Error('test'))).not.toThrow();
});

it('throws if passed something that is not an error', () => {
expect(() => assertIsError('test')).toThrow(
`Invalid error of type 'string'`,
);
});
});
});

0 comments on commit 498d6db

Please sign in to comment.