diff --git a/packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts b/packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts index 8251ddf13b..2422955425 100644 --- a/packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts +++ b/packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts @@ -1,4 +1,8 @@ -import { ActionDescriptor, CommandV6 } from "@cursorless/common"; +import { + ActionDescriptor, + CommandResponse, + CommandV6, +} from "@cursorless/common"; export interface SpokenFormTest { /** @@ -12,7 +16,7 @@ export interface SpokenFormTest { * `user.private_cursorless_run_rpc_command_get` action to return the given * value. */ - mockedGetValue: unknown | undefined; + mockedGetValue: CommandResponse | undefined; /** * The sequence of Cursorless commands that should be executed when @@ -28,7 +32,7 @@ export function spokenFormTest( ): SpokenFormTest { return { spokenForm, - mockedGetValue, + mockedGetValue: wrapMockedGetValue(mockedGetValue), commands: [command(spokenForm, action)], }; } @@ -40,11 +44,17 @@ export function multiActionSpokenFormTest( ): SpokenFormTest { return { spokenForm, - mockedGetValue, + mockedGetValue: wrapMockedGetValue(mockedGetValue), commands: actions.map((action) => command(spokenForm, action)), }; } +function wrapMockedGetValue( + mockedGetValue: unknown, +): CommandResponse | undefined { + return mockedGetValue == null ? undefined : { returnValue: mockedGetValue }; +} + function command(spokenForm: string, action: ActionDescriptor): CommandV6 { return { version: 6,