-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.mts
56 lines (48 loc) · 1.03 KB
/
index.test.mts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import assert from "node:assert";
import { describe, test } from "node:test";
import { dummyLayout } from "log4js/lib/layouts";
import Level from "log4js/lib/levels";
import type { LoggingEvent } from "log4js";
import { sentry } from "./dist";
function makeLogEvent(): LoggingEvent {
return {
categoryName: "default",
startTime: new Date(),
data: ["test"],
pid: 0,
fileName: "",
lineNumber: 0,
columnNumber: 0,
callStack: "",
functionName: "",
context: null,
serialise: () => "",
level: new Level(40000, "ERROR", "red"),
};
}
/**
* TODO: fetch events from sentry to validate integration
* TODO: validate if dsn is valid
* TODO: shutdown test
*/
describe("Sentry integration", () => {
const appender = sentry(
{
dsn: "<your_token>",
},
Level,
dummyLayout,
);
test("append log", async () => {
const logEvent = makeLogEvent();
assert.doesNotThrow(() => {
appender(logEvent);
});
});
test("shutdown", () => {
assert.doesNotThrow(() => {
// @ts-ignore
appender.shutdown();
});
});
});