1
- import { ActionDescriptor , CommandV6 } from "@cursorless/common" ;
1
+ import {
2
+ ActionDescriptor ,
3
+ CommandResponse ,
4
+ CommandV6 ,
5
+ } from "@cursorless/common" ;
2
6
3
7
export interface SpokenFormTest {
4
8
/**
@@ -12,7 +16,7 @@ export interface SpokenFormTest {
12
16
* `user.private_cursorless_run_rpc_command_get` action to return the given
13
17
* value.
14
18
*/
15
- mockedGetValue : unknown | undefined ;
19
+ mockedGetValue : CommandResponse | undefined ;
16
20
17
21
/**
18
22
* The sequence of Cursorless commands that should be executed when
@@ -28,7 +32,7 @@ export function spokenFormTest(
28
32
) : SpokenFormTest {
29
33
return {
30
34
spokenForm,
31
- mockedGetValue,
35
+ mockedGetValue : wrapMockedGetValue ( mockedGetValue ) ,
32
36
commands : [ command ( spokenForm , action ) ] ,
33
37
} ;
34
38
}
@@ -40,11 +44,17 @@ export function multiActionSpokenFormTest(
40
44
) : SpokenFormTest {
41
45
return {
42
46
spokenForm,
43
- mockedGetValue,
47
+ mockedGetValue : wrapMockedGetValue ( mockedGetValue ) ,
44
48
commands : actions . map ( ( action ) => command ( spokenForm , action ) ) ,
45
49
} ;
46
50
}
47
51
52
+ function wrapMockedGetValue (
53
+ mockedGetValue : unknown ,
54
+ ) : CommandResponse | undefined {
55
+ return mockedGetValue == null ? undefined : { returnValue : mockedGetValue } ;
56
+ }
57
+
48
58
function command ( spokenForm : string , action : ActionDescriptor ) : CommandV6 {
49
59
return {
50
60
version : 6 ,
0 commit comments