@@ -51,10 +51,15 @@ describe("ExportInfo", () => {
5151
5252 it ( "clears the target map, the max-target memo and canInlineProvide" , ( ) => {
5353 const info = new ExportInfo ( "foo" ) ;
54- info . setTarget ( { } , /** @type {EXPECTED_ANY } */ ( { } ) , [ "a" ] , 1 ) ;
54+ info . setTarget (
55+ /** @type {EXPECTED_ANY } */ ( { } ) ,
56+ /** @type {EXPECTED_ANY } */ ( { } ) ,
57+ [ "a" ] ,
58+ 1
59+ ) ;
5560 // prime the memo so a stale entry would be observable
5661 info . _getMaxTarget ( ) ;
57- info . canInlineProvide = true ;
62+ info . canInlineProvide = /** @type { EXPECTED_ANY } */ ( true ) ;
5863
5964 info . _resetProvideInfo ( ) ;
6065
@@ -117,10 +122,15 @@ describe("ExportInfo", () => {
117122
118123 info . _resetUseInfo ( ) ;
119124
120- expect ( info . _globalUsed ) . toBeUndefined ( ) ;
121- expect ( info . _usedInRuntime ) . toBeUndefined ( ) ;
122- expect ( info . _hasUseInRuntimeInfo ) . toBe ( false ) ;
123- expect ( info . _usedName ) . toBeNull ( ) ;
125+ // no use info at all until the plugin re-initializes
126+ expect ( info . getUsed ( "main" ) ) . toBe ( UsageState . NoInfo ) ;
127+ // after re-init the cleared state reads as unused in every runtime
128+ info . setHasUseInfo ( ) ;
129+ expect ( info . getUsed ( undefined ) ) . toBe ( UsageState . Unused ) ;
130+ expect ( info . getUsed ( "main" ) ) . toBe ( UsageState . Unused ) ;
131+ // and a fresh use resolves to the export's own name, not the stale "a"
132+ info . setUsed ( UsageState . Used , "main" ) ;
133+ expect ( info . getUsedName ( undefined , "main" ) ) . toBe ( "foo" ) ;
124134 } ) ;
125135
126136 it ( "recurses through two levels of owned nested exports info" , ( ) => {
0 commit comments