Skip to content

Commit 6c4a18c

Browse files
authored
Fix broken spoken form tests (#2293)
Looks like these broke in #2235 ## Checklist - [-] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
1 parent 957caee commit 6c4a18c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { ActionDescriptor, CommandV6 } from "@cursorless/common";
1+
import {
2+
ActionDescriptor,
3+
CommandResponse,
4+
CommandV6,
5+
} from "@cursorless/common";
26

37
export interface SpokenFormTest {
48
/**
@@ -12,7 +16,7 @@ export interface SpokenFormTest {
1216
* `user.private_cursorless_run_rpc_command_get` action to return the given
1317
* value.
1418
*/
15-
mockedGetValue: unknown | undefined;
19+
mockedGetValue: CommandResponse | undefined;
1620

1721
/**
1822
* The sequence of Cursorless commands that should be executed when
@@ -28,7 +32,7 @@ export function spokenFormTest(
2832
): SpokenFormTest {
2933
return {
3034
spokenForm,
31-
mockedGetValue,
35+
mockedGetValue: wrapMockedGetValue(mockedGetValue),
3236
commands: [command(spokenForm, action)],
3337
};
3438
}
@@ -40,11 +44,17 @@ export function multiActionSpokenFormTest(
4044
): SpokenFormTest {
4145
return {
4246
spokenForm,
43-
mockedGetValue,
47+
mockedGetValue: wrapMockedGetValue(mockedGetValue),
4448
commands: actions.map((action) => command(spokenForm, action)),
4549
};
4650
}
4751

52+
function wrapMockedGetValue(
53+
mockedGetValue: unknown,
54+
): CommandResponse | undefined {
55+
return mockedGetValue == null ? undefined : { returnValue: mockedGetValue };
56+
}
57+
4858
function command(spokenForm: string, action: ActionDescriptor): CommandV6 {
4959
return {
5060
version: 6,

0 commit comments

Comments
 (0)