add test env
This commit is contained in:
1 parent
75acf7b38f
commit
b4da045770
7 files changed
+6809
-2
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import ApiError from "@/utils/ApiError.js";
|
||||
|
||||
describe("ApiError", () => {
|
||||
it("captures message and status", () => {
|
||||
const error = new ApiError("boom", 418);
|
||||
expect(error).toBeInstanceOf(Error);
|
||||
expect(error.message).toBe("boom");
|
||||
expect(error.status).toBe(418);
|
||||
expect(error.name).toBe("ApiError");
|
||||
});
|
||||
|
||||
it("defaults status to 500", () => {
|
||||
const error = new ApiError("failure");
|
||||
expect(error.status).toBe(500);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user