Skip to content

Commit d6a82d5

Browse files
committed
chore(smithy-client): add unit tests
1 parent b0cc1f8 commit d6a82d5

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/smithy-client/src/exceptions.spec.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { decorateServiceException, ServiceException } from "./exceptions";
1+
import { decorateServiceException, ExceptionOptionType, ServiceException } from "./exceptions";
22

33
it("ServiceException extends from Error", () => {
44
expect(
@@ -11,6 +11,23 @@ it("ServiceException extends from Error", () => {
1111
).toBeInstanceOf(Error);
1212
});
1313

14+
it("ExceptionOptionType allows specifying message", () => {
15+
class SomeException extends ServiceException {
16+
constructor(opts: ExceptionOptionType<SomeException, ServiceException>) {
17+
super({
18+
name: "SomeException",
19+
$fault: "client",
20+
...opts,
21+
});
22+
}
23+
}
24+
const exception = new SomeException({
25+
message: "message",
26+
$metadata: {},
27+
});
28+
expect(exception.message).toBe("message");
29+
});
30+
1431
describe("decorateServiceException", () => {
1532
const exception = new ServiceException({
1633
name: "Error",

0 commit comments

Comments
 (0)