@@ -28,6 +28,10 @@ const scriptWithImportMap = resolveTestDataURL(
2828 "with_import_map/plugin_with_import_map.ts" ,
2929) ;
3030
31+ const scriptWithImportMapJsonc = resolveTestDataURL (
32+ "with_import_map_jsonc/plugin_with_import_map_jsonc.ts" ,
33+ ) ;
34+
3135Deno . test ( "Plugin" , async ( t ) => {
3236 const meta : Meta = {
3337 mode : "debug" ,
@@ -545,6 +549,56 @@ Deno.test("Plugin", async (t) => {
545549 assertEquals ( result , "Hello from mapped import!" ) ;
546550 } ) ;
547551
552+ await t . step ( "loads plugin with import_map.jsonc" , async ( ) => {
553+ const denops = createDenops ( ) ;
554+ using _denops_call = stub ( denops , "call" ) ;
555+ using _denops_cmd = stub ( denops , "cmd" ) ;
556+
557+ const plugin = new Plugin (
558+ denops ,
559+ "test-plugin" ,
560+ scriptWithImportMapJsonc ,
561+ ) ;
562+
563+ await plugin . waitLoaded ( ) ;
564+
565+ // Should emit events
566+ assertSpyCalls ( _denops_call , 2 ) ;
567+ assertSpyCall ( _denops_call , 0 , {
568+ args : [
569+ "denops#_internal#event#emit" ,
570+ "DenopsSystemPluginPre:test-plugin" ,
571+ ] ,
572+ } ) ;
573+ assertSpyCall ( _denops_call , 1 , {
574+ args : [
575+ "denops#_internal#event#emit" ,
576+ "DenopsSystemPluginPost:test-plugin" ,
577+ ] ,
578+ } ) ;
579+
580+ // Should call the plugin's main function
581+ assertSpyCalls ( _denops_cmd , 1 ) ;
582+ assertSpyCall ( _denops_cmd , 0 , {
583+ args : [ "echo 'Import map jsonc plugin initialized'" ] ,
584+ } ) ;
585+
586+ // Reset spy calls
587+ _denops_cmd . calls . length = 0 ;
588+
589+ // Call the dispatcher function
590+ const result = await plugin . call ( "test" ) ;
591+
592+ // Should execute the command with the message from the mapped import
593+ assertSpyCalls ( _denops_cmd , 1 ) ;
594+ assertSpyCall ( _denops_cmd , 0 , {
595+ args : [ "echo 'Import map jsonc works for test-plugin!'" ] ,
596+ } ) ;
597+
598+ // Should return the greeting from the mapped import
599+ assertEquals ( result , "Hello from jsonc mapped import!" ) ;
600+ } ) ;
601+
548602 await t . step ( "works without import map" , async ( ) => {
549603 const denops = createDenops ( ) ;
550604 using _denops_call = stub ( denops , "call" ) ;
0 commit comments