All checks were successful
CI Monitor MIflow / build-image (push) Successful in 2m42s
33 lines
1.8 KiB
TypeScript
33 lines
1.8 KiB
TypeScript
import { test } from "bun:test"
|
|
|
|
import diffTools from "../controllers/manageMrEvent/utils/diffTools"
|
|
import loggerIns from "../log"
|
|
|
|
test("parseReview", async () => {
|
|
const logger = loggerIns.child({ requestId: "test" })
|
|
const response = `
|
|
1-12:
|
|
LGTM!
|
|
---
|
|
67-70:
|
|
在生产环境中,\`console.log\`可能会导致性能问题,建议移除或使用更合适的方式进行调试。
|
|
\`\`\`diff
|
|
- console.log(
|
|
- '🚀 ~ file: index.tsx:68 ~ ModelSquare ~ item.apiDoc:',
|
|
- item.apiDoc,
|
|
- );
|
|
\`\`\`
|
|
---
|
|
`
|
|
const diffs = [
|
|
[
|
|
1,
|
|
12,
|
|
"\\n---new_hunk---\\n```\\n import { Button, Space, Tag, Typography } from 'antd';\\n import classnames from 'classnames';\\n import { memo } from 'react';\\n4: \\n5: import ChatGLM from '../../assets/ChatGLM.png';\\n6: import CVLM from '../../assets/CVLM.png';\\n7: import inner from '../../assets/inner.png';\\n8: import Llama from '../../assets/Llama.png';\\n9: import MICV from '../../assets/MICV.png';\\n import MiniGPT from '../../assets/MiniGPT.png';\\n import Mixtral from '../../assets/Mixtral.png';\\n import Qwen from '../../assets/Qwen.png';\\n```\\n\\n---old_hunk---\\n```\\n import { Button, Space, Tag, Typography } from 'antd';\\n import classnames from 'classnames';\\n import { memo } from 'react';\\n import ChatGLM from '../../assets/ChatGLM.png';\\n import inner from '../../assets/inner.png';\\n import Llama from '../../assets/Llama.png';\\n import MiniGPT from '../../assets/MiniGPT.png';\\n import Mixtral from '../../assets/Mixtral.png';\\n import Qwen from '../../assets/Qwen.png';\\n```\\n ",
|
|
],
|
|
] as Array<[number, number, string]>
|
|
|
|
const res = diffTools.parseReview(response, diffs)
|
|
logger.info(JSON.stringify(res))
|
|
}, 100000)
|