@@ -6,21 +6,22 @@ import { webviewMessageHandler } from "../../../core/webview/webviewMessageHandl
66const mockProvider = {
77 getState : vi . fn ( ) ,
88 postStateToWebview : vi . fn ( ) ,
9+ postMessageToWebview : vi . fn ( ) ,
910} as any
1011
1112const mockMarketplaceManager = {
1213 updateWithFilteredItems : vi . fn ( ) ,
1314} as any
1415
15- describe ( "Marketplace Setting Check " , ( ) => {
16+ describe ( "Marketplace General Availability " , ( ) => {
1617 beforeEach ( ( ) => {
1718 vi . clearAllMocks ( )
1819 } )
1920
20- it ( "should skip API calls when marketplace is disabled " , async ( ) => {
21- // Mock experiments with marketplace disabled
21+ it ( "should allow marketplace API calls ( marketplace is generally available) " , async ( ) => {
22+ // Mock state without marketplace experiment (since it's now generally available)
2223 mockProvider . getState . mockResolvedValue ( {
23- experiments : { marketplace : false } ,
24+ experiments : { } ,
2425 } )
2526
2627 const message = {
@@ -30,25 +31,7 @@ describe("Marketplace Setting Check", () => {
3031
3132 await webviewMessageHandler ( mockProvider , message , mockMarketplaceManager )
3233
33- // Should not call marketplace manager methods
34- expect ( mockMarketplaceManager . updateWithFilteredItems ) . not . toHaveBeenCalled ( )
35- expect ( mockProvider . postStateToWebview ) . not . toHaveBeenCalled ( )
36- } )
37-
38- it ( "should allow API calls when marketplace is enabled" , async ( ) => {
39- // Mock experiments with marketplace enabled
40- mockProvider . getState . mockResolvedValue ( {
41- experiments : { marketplace : true } ,
42- } )
43-
44- const message = {
45- type : "filterMarketplaceItems" as const ,
46- filters : { type : "mcp" , search : "" , tags : [ ] } ,
47- }
48-
49- await webviewMessageHandler ( mockProvider , message , mockMarketplaceManager )
50-
51- // Should call marketplace manager methods
34+ // Should call marketplace manager methods since marketplace is generally available
5235 expect ( mockMarketplaceManager . updateWithFilteredItems ) . toHaveBeenCalledWith ( {
5336 type : "mcp" ,
5437 search : "" ,
@@ -57,13 +40,13 @@ describe("Marketplace Setting Check", () => {
5740 expect ( mockProvider . postStateToWebview ) . toHaveBeenCalled ( )
5841 } )
5942
60- it ( "should skip installation when marketplace is disabled " , async ( ) => {
61- // Mock experiments with marketplace disabled
43+ it ( "should allow marketplace installation ( marketplace is generally available) " , async ( ) => {
44+ // Mock state without marketplace experiment (since it's now generally available)
6245 mockProvider . getState . mockResolvedValue ( {
63- experiments : { marketplace : false } ,
46+ experiments : { } ,
6447 } )
6548
66- const mockInstallMarketplaceItem = vi . fn ( )
49+ const mockInstallMarketplaceItem = vi . fn ( ) . mockResolvedValue ( undefined )
6750 const mockMarketplaceManagerWithInstall = {
6851 installMarketplaceItem : mockInstallMarketplaceItem ,
6952 }
@@ -83,7 +66,7 @@ describe("Marketplace Setting Check", () => {
8366
8467 await webviewMessageHandler ( mockProvider , message , mockMarketplaceManagerWithInstall as any )
8568
86- // Should not call install method
87- expect ( mockInstallMarketplaceItem ) . not . toHaveBeenCalled ( )
69+ // Should call install method since marketplace is generally available
70+ expect ( mockInstallMarketplaceItem ) . toHaveBeenCalledWith ( message . mpItem , message . mpInstallOptions )
8871 } )
8972} )
0 commit comments