@@ -158,7 +158,7 @@ test({
158158 await t . step ( "does not unregister lambda functions" , async ( ) => {
159159 const fn = spy ( returnsNext ( [ "foo" ] ) ) ;
160160 const id = lambda . register ( denops , fn ) ;
161- lambda . unregister ( denops , "not-registered-id" ) ;
161+ lambda . unregister ( denops , "lambda: not-registered-id" ) ;
162162
163163 assertSpyCalls ( fn , 0 ) ;
164164 assertEquals (
@@ -169,7 +169,35 @@ test({
169169 assertSpyCalls ( fn , 1 ) ;
170170 } ) ;
171171 await t . step ( "returns `false`" , ( ) => {
172- assertEquals ( lambda . unregister ( denops , "not-registered-id" ) , false ) ;
172+ assertEquals (
173+ lambda . unregister ( denops , "lambda:not-registered-id" ) ,
174+ false ,
175+ ) ;
176+ } ) ;
177+ } ) ;
178+ await t . step ( "if 'id' is not a lambda identifier" , async ( t ) => {
179+ await t . step ( "does not unregister method" , async ( ) => {
180+ const fn = spy ( returnsNext ( [ "foo" ] ) ) ;
181+ const notLambdaId = "not-lambda-id" ;
182+ denops . dispatcher = {
183+ [ notLambdaId ] : fn ,
184+ } ;
185+ lambda . unregister ( denops , notLambdaId ) ;
186+
187+ assertSpyCalls ( fn , 0 ) ;
188+ assertEquals (
189+ await denops . dispatch ( denops . name , notLambdaId ) ,
190+ "foo" ,
191+ "The method is available" ,
192+ ) ;
193+ assertSpyCalls ( fn , 1 ) ;
194+ } ) ;
195+ await t . step ( "returns `false`" , ( ) => {
196+ const notLambdaId = "not-lambda-id" ;
197+ denops . dispatcher = {
198+ [ notLambdaId ] : ( ) => "foo" ,
199+ } ;
200+ assertEquals ( lambda . unregister ( denops , notLambdaId ) , false ) ;
173201 } ) ;
174202 } ) ;
175203 } ) ;
0 commit comments