feat: 日报新增模板市场,支持社区模板安装与使用

This commit is contained in:
Wxw-Gu
2026-09-08 11:37:38 +08:00
parent 1156362c3c
commit 976aac32c5
35 changed files with 2957 additions and 82 deletions
+22
View File
@@ -245,6 +245,28 @@ describe('Local API authentication', () => {
expect(fixture.testSend).toHaveBeenCalledOnce()
})
it('rejects external template refs on the legacy report HTTP API', async () => {
const handle = await startFixtureServer()
const response = await fetch(`${baseUrl(handle)}/api/v1/report`, {
method: 'POST',
headers: {
Authorization: `Bearer ${VALID_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
report: {},
metadata: {},
templateRef: { id: 'community.github.example.template', version: '1.0.0' }
})
})
expect(response.status).toBe(400)
await expect(response.json()).resolves.toMatchObject({
status: 400,
error: 'HTTP API 暂不支持外部日报模板,请使用内置 templateId',
details: { code: 'external_template_unsupported' }
})
})
it.each([
'http://localhost',
'http://localhost:5173',