feat: add official game audio generation client

This commit is contained in:
2026-09-21 12:17:32 +08:00
parent d222d17500
commit 09e0ce5cf3
28 changed files with 1835 additions and 31 deletions

View File

@@ -46,6 +46,16 @@ async function invoke(ctx: HostApiContext, method: string, target: string, body?
}
describe('coding plugin Host routes', () => {
it('previews only a receipt output, without accepting project paths or remote URLs', async () => {
const readSavedOutput = vi.fn().mockResolvedValue({ path: 'assets/generated/game-audio/file.mp3', dataUrl: 'data:audio/mpeg;base64,SUQz' });
const ctx = { codingProducts: { gameAudio: { readSavedOutput } } } as unknown as HostApiContext;
const id = '00000000-0000-4000-8000-000000000601';
const route = '/api/coding/game-audio/' + id + '/outputs/0';
expect(await invoke(ctx, 'GET', route)).toMatchObject({ handled: true, status: 200 });
expect(readSavedOutput).toHaveBeenCalledWith(id, 0);
expect(await invoke(ctx, 'GET', route + '?projectPath=/forged')).toMatchObject({ status: 400 });
expect(readSavedOutput).toHaveBeenCalledTimes(1);
});
it('uses only the local project handle for GET and preserves the bounded projection', async () => {
const projection = {
schemaVersion: 1 as const,