收敛客户端静态发布链路

This commit is contained in:
2026-08-10 17:04:29 +08:00
parent 2e737dee31
commit 4df047708b
37 changed files with 604 additions and 3071 deletions

View File

@@ -12,7 +12,6 @@ import {
fetchWorksProjects,
publishWorksProjectSource,
toPlazaCard,
uploadWorksProjectZip,
WorksSquareApiError,
type ProjectPublic,
} from '@/lib/works-square';
@@ -313,43 +312,6 @@ describe('works square client', () => {
expect(error.message).toBe('Conflict');
});
it('uploads a project zip version with the current access token', async () => {
hostApiFetchMock.mockResolvedValueOnce({
success: true,
upload: {
version_id: 'b2f6f1dd-cf4b-4f03-a4b8-a71e2c8dd5f1',
review_status: 'building',
},
});
const result = await uploadWorksProjectZip({
accessToken: 'access-token',
appId: 'space cleaner',
projectId: 'project-1',
versionName: 'v1.0.0',
changeLog: 'Initial upload',
zipFilePath: '/tmp/project.zip',
});
expect(result).toEqual({
version_id: 'b2f6f1dd-cf4b-4f03-a4b8-a71e2c8dd5f1',
review_status: 'building',
});
expect(hostApiFetchMock).toHaveBeenCalledWith(
'/api/works/projects/space%20cleaner/versions/upload',
{
method: 'POST',
body: JSON.stringify({
accessToken: 'access-token',
projectId: 'project-1',
versionName: 'v1.0.0',
changeLog: 'Initial upload',
zipFilePath: '/tmp/project.zip',
}),
},
);
});
it('asks Main to package and submit source without renderer-owned secrets or archive fields', async () => {
const publishResult = {
package: {
@@ -483,7 +445,8 @@ describe('works square client', () => {
difficulty: 'beginner',
updated_at: '2026-06-20T22:55:37.790408+08:00',
playable: true,
runtime_url: '/apps/space-cleaner/',
play_url: '/apps/space-cleaner/',
runtime_url: '/apps/legacy-space-cleaner/',
};
expect(toPlazaCard(project)).toEqual({
@@ -499,4 +462,16 @@ describe('works square client', () => {
runtimeUrl: '/apps/space-cleaner/',
});
});
it('keeps runtime_url as a compatibility fallback for one release', () => {
const project: ProjectPublic = {
app_id: 'legacy-game',
title: 'Legacy Game',
summary: 'Compatibility fixture',
playable: true,
runtime_url: '/apps/legacy-game/',
};
expect(toPlazaCard(project).runtimeUrl).toBe('/apps/legacy-game/');
});
});