@@ -158,7 +158,7 @@ test({
158
158
await t . step ( "does not unregister lambda functions" , async ( ) => {
159
159
const fn = spy ( returnsNext ( [ "foo" ] ) ) ;
160
160
const id = lambda . register ( denops , fn ) ;
161
- lambda . unregister ( denops , "not-registered-id" ) ;
161
+ lambda . unregister ( denops , "lambda: not-registered-id" ) ;
162
162
163
163
assertSpyCalls ( fn , 0 ) ;
164
164
assertEquals (
@@ -169,7 +169,35 @@ test({
169
169
assertSpyCalls ( fn , 1 ) ;
170
170
} ) ;
171
171
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 ) ;
173
201
} ) ;
174
202
} ) ;
175
203
} ) ;
0 commit comments