@@ -12,6 +12,7 @@ Deno.test("invoke", async (t) => {
1212 const service : Omit < Service , "bind" > = {
1313 load : ( ) => unimplemented ( ) ,
1414 reload : ( ) => unimplemented ( ) ,
15+ interrupt : ( ) => unimplemented ( ) ,
1516 dispatch : ( ) => unimplemented ( ) ,
1617 dispatchAsync : ( ) => unimplemented ( ) ,
1718 } ;
@@ -46,6 +47,28 @@ Deno.test("invoke", async (t) => {
4647 } ) ;
4748 } ) ;
4849
50+ await t . step ( "calls 'interrupt'" , async ( t ) => {
51+ await t . step ( "ok" , async ( ) => {
52+ using s = stub ( service , "interrupt" ) ;
53+ await invoke ( service , "interrupt" , [ ] ) ;
54+ assertSpyCalls ( s , 1 ) ;
55+ assertSpyCall ( s , 0 , { args : [ ] } ) ;
56+ } ) ;
57+
58+ await t . step ( "ok (with reason)" , async ( ) => {
59+ using s = stub ( service , "interrupt" ) ;
60+ await invoke ( service , "interrupt" , [ "reason" ] ) ;
61+ assertSpyCalls ( s , 1 ) ;
62+ assertSpyCall ( s , 0 , { args : [ "reason" ] } ) ;
63+ } ) ;
64+
65+ await t . step ( "invalid args" , ( ) => {
66+ using s = stub ( service , "interrupt" ) ;
67+ assertThrows ( ( ) => invoke ( service , "interrupt" , [ "a" , "b" ] ) , AssertError ) ;
68+ assertSpyCalls ( s , 0 ) ;
69+ } ) ;
70+ } ) ;
71+
4972 await t . step ( "calls 'dispatch'" , async ( t ) => {
5073 await t . step ( "ok" , async ( ) => {
5174 using s = stub ( service , "dispatch" ) ;
0 commit comments