mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
chore(quality): provider fixtures, formatter snapshots, platform contract tests, CI, CodeQL, dependabot
This commit is contained in:
15 files changed
+405
-3
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { describe, test, expect } from "bun:test";
|
||||
import { formatEvent } from "../server/lib/formatters";
|
||||
import type { NeutralMessage, Route, WebhookEvent } from "../server/lib/types";
|
||||
import { githubPush, githubPullRequest, githubIssues } from "./fixtures";
|
||||
|
||||
const route: Route = {
|
||||
id: "test",
|
||||
name: "Test",
|
||||
enabled: true,
|
||||
filters: [],
|
||||
targets: [{ channelId: "111" }],
|
||||
};
|
||||
|
||||
function event(ev: string, payload: Record<string, unknown>): WebhookEvent {
|
||||
return { event: ev, payload };
|
||||
}
|
||||
|
||||
function stable(msg: NeutralMessage): NeutralMessage {
|
||||
return { ...msg, timestamp: msg.timestamp ? "TIMESTAMP" : msg.timestamp };
|
||||
}
|
||||
|
||||
describe("formatter snapshots", () => {
|
||||
test("push", () => {
|
||||
expect(stable(formatEvent(route, event("push", githubPush)))).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test("pull_request", () => {
|
||||
expect(stable(formatEvent(route, event("pull_request", githubPullRequest)))).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test("issues", () => {
|
||||
expect(stable(formatEvent(route, event("issues", githubIssues)))).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user