Skip to content

Commit

Permalink
Fix broken spoken form tests (#2293)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pokey authored Apr 21, 2024
1 parent 957caee commit 6c4a18c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { ActionDescriptor, CommandV6 } from "@cursorless/common";
import {
ActionDescriptor,
CommandResponse,
CommandV6,
} from "@cursorless/common";

export interface SpokenFormTest {
/**
Expand All @@ -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
Expand All @@ -28,7 +32,7 @@ export function spokenFormTest(
): SpokenFormTest {
return {
spokenForm,
mockedGetValue,
mockedGetValue: wrapMockedGetValue(mockedGetValue),
commands: [command(spokenForm, action)],
};
}
Expand All @@ -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,
Expand Down

0 comments on commit 6c4a18c

Please sign in to comment.