
























@@ -146,39 +146,44 @@ function resetMusicGenerateMocks() {
146146}
147147148148function detailsOf(result: { details?: unknown }): Record<string, unknown> {
149-expect(typeof result.details).toBe("object");
150-expect(result.details).not.toBeNull();
149+if (!result.details || typeof result.details !== "object") {
150+throw new Error("expected result details object");
151+}
151152return result.details as Record<string, unknown>;
152153}
153154154155function generateMusicOptions(
155156callIndex = musicGenerationRuntimeMocks.generateMusic.mock.calls.length - 1,
156157): Record<string, unknown> {
157158const options = musicGenerationRuntimeMocks.generateMusic.mock.calls[callIndex]?.[0];
158-expect(typeof options).toBe("object");
159-expect(options).not.toBeNull();
159+if (!options || typeof options !== "object") {
160+throw new Error(`expected generateMusic options ${callIndex}`);
161+}
160162return options as Record<string, unknown>;
161163}
162164163165function taskProgressCall(callIndex = 0): Record<string, unknown> {
164166const call = taskExecutorMocks.recordTaskRunProgressByRunId.mock.calls[callIndex]?.[0];
165-expect(typeof call).toBe("object");
166-expect(call).not.toBeNull();
167+if (!call || typeof call !== "object") {
168+throw new Error(`expected task progress call ${callIndex}`);
169+}
167170return call as Record<string, unknown>;
168171}
169172170173function taskCompleteCall(callIndex = 0): Record<string, unknown> {
171174const call = taskExecutorMocks.completeTaskRunByRunId.mock.calls[callIndex]?.[0];
172-expect(typeof call).toBe("object");
173-expect(call).not.toBeNull();
175+if (!call || typeof call !== "object") {
176+throw new Error(`expected task complete call ${callIndex}`);
177+}
174178return call as Record<string, unknown>;
175179}
176180177181function wakeCompletionCall(callIndex = 0): Record<string, unknown> {
178182const call =
179183musicGenerateBackgroundMocks.wakeMusicGenerationTaskCompletion.mock.calls[callIndex]?.[0];
180-expect(typeof call).toBe("object");
181-expect(call).not.toBeNull();
184+if (!call || typeof call !== "object") {
185+throw new Error(`expected wake completion call ${callIndex}`);
186+}
182187return call as Record<string, unknown>;
183188}
184189此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。