Skip to content

Commit 9b35d0e

Browse files
test: initial test for onlyInstancesOf
1 parent 63916af commit 9b35d0e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

__tests__/errors.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use strict";
2+
3+
const UsageError = require("../errors").UsageError;
4+
const onlyInstancesOf = require("../errors").onlyInstancesOf;
5+
6+
describe("onlyInstancesOf", () => {
7+
test("catches specified error", () => {
8+
return Promise.reject(new UsageError('fake usage error'))
9+
.catch(onlyInstancesOf(UsageError, (error) => {
10+
expect(error).toBeInstanceOf(UsageError);
11+
}));
12+
});
13+
});

0 commit comments

Comments
 (0)