update:增加文档模式
This commit is contained in:
@@ -11,6 +11,8 @@ interface ToolDetailResponse {
|
||||
slug: string;
|
||||
name: string;
|
||||
description: string;
|
||||
accessMode: string;
|
||||
displayVersion: string | null;
|
||||
}
|
||||
|
||||
describe('Tools detail by slug (e2e)', () => {
|
||||
@@ -51,6 +53,7 @@ describe('Tools detail by slug (e2e)', () => {
|
||||
description: '# Manual\n\n## Install',
|
||||
accessMode: AccessMode.web,
|
||||
openUrl: 'https://example.com/tool',
|
||||
versionOverride: '2026.04',
|
||||
status: ToolStatus.published,
|
||||
updatedAt: '2026-04-11',
|
||||
},
|
||||
@@ -87,10 +90,46 @@ describe('Tools detail by slug (e2e)', () => {
|
||||
expect(body.slug).toBe(toolSlug);
|
||||
expect(body.name).toBe('Slug Detail Tool');
|
||||
expect(body.description).toContain('# Manual');
|
||||
expect(body.accessMode).toBe(AccessMode.web);
|
||||
expect(body.displayVersion).toBe('2026.04');
|
||||
});
|
||||
});
|
||||
|
||||
it('returns 404 for an unknown slug', async () => {
|
||||
await request(getHttpServer()).get('/tools/slug/missing-tool').expect(404);
|
||||
});
|
||||
|
||||
it('returns none mode tool detail with displayVersion', async () => {
|
||||
const noneToolId = `tool_${randomUUID().replace(/-/g, '')}`;
|
||||
const noneToolSlug = `none-tool-${randomUUID().slice(0, 8)}`;
|
||||
|
||||
await prisma.tool.create({
|
||||
data: {
|
||||
id: noneToolId,
|
||||
name: 'Preview Tool',
|
||||
slug: noneToolSlug,
|
||||
categoryId,
|
||||
description: '# Preview\n\n即将上线',
|
||||
accessMode: 'none' as AccessMode,
|
||||
versionOverride: 'preview-1',
|
||||
status: ToolStatus.published,
|
||||
updatedAt: '2026-04-11',
|
||||
},
|
||||
});
|
||||
|
||||
await request(getHttpServer())
|
||||
.get(`/tools/slug/${noneToolSlug}`)
|
||||
.expect(200)
|
||||
.expect(({ body }: { body: ToolDetailResponse }) => {
|
||||
expect(body.id).toBe(noneToolId);
|
||||
expect(body.accessMode).toBe('none');
|
||||
expect(body.displayVersion).toBe('preview-1');
|
||||
});
|
||||
|
||||
await prisma.tool.deleteMany({
|
||||
where: {
|
||||
id: noneToolId,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user