chore(quality): provider fixtures, formatter snapshots, platform contract tests, CI, CodeQL, dependabot

This commit is contained in:
RhenCloud 2026-08-15 17:30:51 +08:00
parent 04fa52db52
commit 320e825bf8
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
15 changed files with 405 additions and 3 deletions

View file

@ -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();
});
});