mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
Add test for #67
This commit is contained in:
parent
64146c8990
commit
4df6cabd0e
12
src/etapi/etapi_utils.test.ts
Normal file
12
src/etapi/etapi_utils.test.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import etapiUtils = require("./etapi_utils");
|
||||||
|
const EtapiError = etapiUtils.EtapiError;
|
||||||
|
|
||||||
|
describe("EtapiError", () => {
|
||||||
|
it("should support instanceof", () => {
|
||||||
|
const anError = new etapiUtils.EtapiError(404, "123", "test");
|
||||||
|
expect(anError instanceof EtapiError).toBeTruthy();
|
||||||
|
expect(anError instanceof Error).toBeTruthy();
|
||||||
|
expect(new Error("Test") instanceof EtapiError).toBeFalsy();
|
||||||
|
anError.foo();
|
||||||
|
});
|
||||||
|
});
|
@ -23,6 +23,10 @@ class EtapiError extends Error {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foo() {
|
||||||
|
console.log("bar");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendError(res: Response, statusCode: number, code: string, message: string) {
|
function sendError(res: Response, statusCode: number, code: string, message: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user