aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/errors.test.ts27
-rw-r--r--src/errors.ts2
2 files changed, 29 insertions, 0 deletions
diff --git a/src/errors.test.ts b/src/errors.test.ts
new file mode 100644
index 0000000..235c0d2
--- /dev/null
+++ b/src/errors.test.ts
@@ -0,0 +1,27 @@
+import { InvalidReportDocumentError, BranchNotFoundError } from "./errors";
+
+describe("InvalidReportDocumentError", () => {
+ it("should have the correct name and default message", () => {
+ // Arrange
+
+ // Act
+ const err = new InvalidReportDocumentError();
+
+ // Assert
+ expect(err.name).toEqual("InvalidReportDocumentError");
+ expect(err.message).toEqual("Invalid report document");
+ });
+});
+
+describe("BranchNotFoundError", () => {
+ it("should have the correct name and default message", () => {
+ // Arrange
+
+ // Act
+ const err = new BranchNotFoundError();
+
+ // Assert
+ expect(err.name).toEqual("BranchNotFoundError");
+ expect(err.message).toEqual("Branch not found");
+ });
+});
diff --git a/src/errors.ts b/src/errors.ts
index 3af634d..6e8c32f 100644
--- a/src/errors.ts
+++ b/src/errors.ts
@@ -1,6 +1,7 @@
export class BranchNotFoundError extends Error {
constructor() {
super();
+ this.name = "BranchNotFoundError";
this.message = "Branch not found";
}
}
@@ -8,6 +9,7 @@ export class BranchNotFoundError extends Error {
export class InvalidReportDocumentError extends Error {
constructor() {
super();
+ this.name = "InvalidReportDocumentError";
this.message = "Invalid report document";
}
}