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

@ -75,8 +75,14 @@ server/ # Nitro server (H3 handlers in server/routes/)
└── locales/ # en.ts, zh.ts translation dictionaries
tests/ # Unit tests (bun test)
tests/fixtures/ # Provider payload fixtures (github/gitea/custom)
tests/__snapshots__/ # Formatter snapshot golden files
```
Continuous integration (`.github/workflows/ci.yml`) runs `bun install --frozen-lockfile`,
`bun test`, and `bun run lint`. CodeQL (`codeql.yml`) and Dependabot (`dependabot.yml`) are
configured under `.github/`.
## Scripts
| Command | Description |
@ -112,6 +118,12 @@ bun test
curl http://localhost:8787/health
```
Beyond the per-module unit tests, the suite includes provider fixtures
(`tests/fixtures/` + `tests/provider-fixtures.test.ts`), formatter snapshots
(`tests/formatter-snapshot.test.ts`), and platform contract tests
(`tests/platform-contract.test.ts`) that assert the Discord/Telegram renderers clamp to their
platform limits.
## Adding a New Event Formatter
1. Add the event type to `GITHUB_COLORS` in `server/lib/formatters/colors.ts` (if new color needed)

View file

@ -75,8 +75,13 @@ server/ # Nitro 服务器H3 处理器位于 server/routes/
└── locales/ # en.ts、zh.ts 翻译字典
tests/ # 单元测试 (bun test)
tests/fixtures/ # 提供方负载固件 (github/gitea/custom)
tests/__snapshots__/ # 格式化器快照黄金文件
```
持续集成(`.github/workflows/ci.yml`)运行 `bun install --frozen-lockfile``bun test`
`bun run lint`。CodeQL`codeql.yml`)与 Dependabot`dependabot.yml`)配置在 `.github/` 下。
## 脚本
| 命令 | 说明 |
@ -112,6 +117,11 @@ bun test
curl http://localhost:8787/health
```
除各模块单元测试外,测试套件还包含提供方固件(`tests/fixtures/` +
`tests/provider-fixtures.test.ts`)、格式化器快照(`tests/formatter-snapshot.test.ts`)以及
平台契约测试(`tests/platform-contract.test.ts`,断言 Discord/Telegram 渲染器会截断到各自的
平台限制)。
## 添加新事件格式化器
1. 将事件类型添加到 `server/lib/formatters/colors.ts` 中的 `GITHUB_COLORS`(如果需要新颜色)