fix(design): connect video preparation and playable history

This commit is contained in:
brother7 committed 2026-09-16 15:42:39 +08:00
1 parent 4321c77613
commit 1acca836fe
21 files changed
+900 -115

No files matched your search

+21 -8
View File
@@ -1427,7 +1427,7 @@ describe('V2 Living Form store', () => {
expect(useImageWorkspaceStore.getState().workspace?.form.specificationRevision).toBe(4);
});
it('treats a terminal quote-blocked response as definitive instead of unknown', async () => {
it('stops before quoting when preparation fails even without a blocker event', async () => {
await loadedStore();
submitCommandMock.mockRejectedValueOnce(new ImageWorkspaceApiError(
422,
@@ -1441,7 +1441,11 @@ describe('V2 Living Form store', () => {
});
expect(useImageWorkspaceStore.getState().pendingOperations).toEqual({});
expect(useImageWorkspaceStore.getState().error).toBeNull();
expect(useImageWorkspaceStore.getState().error).toBe('方案还没整理好,请稍后重试');
expect(submitCommandMock).toHaveBeenCalledTimes(1);
expect(submitCommandMock).toHaveBeenCalledWith(expect.objectContaining({
kind: 'apply_input', input: { kind: 'prepare_generation', operations: [] },
}));
});
it('settles an unknown quote from its blocked event, then allows a revised Quote', async () => {
@@ -1528,14 +1532,23 @@ describe('V2 Living Form store', () => {
it('retains an uncertain accepted write and retries the exact same command identity', async () => {
await loadedStore();
submitCommandMock.mockRejectedValueOnce(new Error('network disconnected'));
operationIdMock
.mockReturnValueOnce('operation-prepare')
.mockReturnValueOnce('operation-quote');
submitCommandMock
.mockResolvedValueOnce({
clientOperationId: 'operation-prepare',
runId: 'run-prepare',
workspace: designWorkspaceFixture(),
})
.mockRejectedValueOnce(new Error('network disconnected'));
await expect(useImageWorkspaceStore.getState().requestQuote()).rejects.toThrow(
'network disconnected',
);
const pending = useImageWorkspaceStore.getState().pendingOperations['operation-1'];
const pending = useImageWorkspaceStore.getState().pendingOperations['operation-quote'];
expect(pending).toMatchObject({
id: 'operation-1',
id: 'operation-quote',
status: 'unknown',
command: {
kind: 'request_quote',
@@ -1545,13 +1558,13 @@ describe('V2 Living Form store', () => {
});
submitCommandMock.mockResolvedValueOnce({
clientOperationId: 'operation-1',
clientOperationId: 'operation-quote',
runId: 'run-original',
workspace: designWorkspaceFixture(),
});
await useImageWorkspaceStore.getState().retryOperation('operation-1');
await useImageWorkspaceStore.getState().retryOperation('operation-quote');
expect(submitCommandMock).toHaveBeenNthCalledWith(2, pending.command);
expect(submitCommandMock).toHaveBeenLastCalledWith(pending?.command);
expect(useImageWorkspaceStore.getState().pendingOperations).toEqual({});
});