gitlab_monitor/test/manageMrEvent.test.ts
zhaoyingbo 4c3acbb787
All checks were successful
CI Monitor MIflow / build-image (push) Successful in 1m47s
feat: 更新文件摘要表格中的分隔符转义
2024-08-14 01:37:43 +00:00

39 lines
935 B
TypeScript

import { expect, test } from "bun:test"
import loggerIns from "../log"
import { manageGitlabEventReq } from "../routes/event"
import netTool from "../service/netTool"
import { Gitlab } from "../types/gitlab"
test("manageMrEvent", async () => {
const headers = new Headers({
"x-gitlab-token": "uwnpzb9hvoft28h",
"x-gitlab-event": "Merge Request Hook",
})
const body: Gitlab.MergeRequestEvent = {
object_kind: "merge_request",
event_type: "merge_request",
project: {
id: 139032,
},
object_attributes: {
iid: 505,
state: "opened",
},
}
const req = new Request(
"https://lark-egg.ai.xiaomi.com/gitlab_monitor/event",
{
method: "POST",
headers: headers,
body: JSON.stringify(body),
}
)
const logger = loggerIns.child({ requestId: "test" })
const res = await manageGitlabEventReq(req, logger)
expect(res).toEqual(netTool.ok())
}, 100000)