@@ -5,7 +5,6 @@ import * as utilities from '@contentstack/cli-utilities';
55import ExportMarketplaceApps from '../../../../src/export/modules/marketplace-apps' ;
66import ExportConfig from '../../../../src/types/export-config' ;
77import * as marketplaceAppHelper from '../../../../src/utils/marketplace-app-helper' ;
8- import * as utils from '../../../../src/utils' ;
98
109describe ( 'ExportMarketplaceApps' , ( ) => {
1110 let exportMarketplaceApps : any ;
@@ -106,10 +105,6 @@ describe('ExportMarketplaceApps', () => {
106105 sinon . stub ( marketplaceAppHelper , 'getDeveloperHubUrl' ) . resolves ( 'https://developer-api.contentstack.io' ) ;
107106 sinon . stub ( marketplaceAppHelper , 'createNodeCryptoInstance' ) . resolves ( mockNodeCrypto ) ;
108107 sinon . stub ( marketplaceAppHelper , 'askEncryptionKey' ) . resolves ( 'test-encryption-key' ) ;
109- sinon . stub ( utils , 'getOrgUid' ) . resolves ( 'test-org-uid' ) ;
110- sinon . stub ( utils , 'getDeveloperHubUrl' ) . resolves ( 'https://developer-api.contentstack.io' ) ;
111- sinon . stub ( utils , 'createNodeCryptoInstance' ) . resolves ( mockNodeCrypto ) ;
112- sinon . stub ( utils , 'askEncryptionKey' ) . resolves ( 'test-encryption-key' ) ;
113108 } ) ;
114109
115110 afterEach ( ( ) => {
@@ -300,14 +295,7 @@ describe('ExportMarketplaceApps', () => {
300295
301296 await exportMarketplaceApps . start ( ) ;
302297
303- // Source imports from utils barrel; resolution may use utils or marketplaceAppHelper depending on env (CI vs local)
304- const helperCalled = ( marketplaceAppHelper . createNodeCryptoInstance as sinon . SinonStub ) . calledOnce ;
305- const utilsCalled = ( utils . createNodeCryptoInstance as sinon . SinonStub ) . calledOnce ;
306- expect ( helperCalled || utilsCalled , 'createNodeCryptoInstance should be called exactly once' ) . to . be . true ;
307- expect (
308- ( marketplaceAppHelper . createNodeCryptoInstance as sinon . SinonStub ) . callCount +
309- ( utils . createNodeCryptoInstance as sinon . SinonStub ) . callCount ,
310- ) . to . equal ( 1 ) ;
298+ expect ( ( marketplaceAppHelper . createNodeCryptoInstance as sinon . SinonStub ) . calledOnce ) . to . be . true ;
311299
312300 getAppsCountStub . restore ( ) ;
313301 exportAppsStub . restore ( ) ;
@@ -409,12 +397,12 @@ describe('ExportMarketplaceApps', () => {
409397 const getAppManifestAndAppConfigStub = sinon . stub ( exportMarketplaceApps , 'getAppManifestAndAppConfig' ) . resolves ( ) ;
410398
411399 // Reset the stub call count since it might have been called in previous tests
412- ( utils . createNodeCryptoInstance as sinon . SinonStub ) . resetHistory ( ) ;
400+ ( marketplaceAppHelper . createNodeCryptoInstance as sinon . SinonStub ) . resetHistory ( ) ;
413401
414402 await exportMarketplaceApps . exportApps ( ) ;
415403
416404 // NodeCrypto should not be initialized if no configurations
417- expect ( ( utils . createNodeCryptoInstance as sinon . SinonStub ) . called ) . to . be . false ;
405+ expect ( ( marketplaceAppHelper . createNodeCryptoInstance as sinon . SinonStub ) . called ) . to . be . false ;
418406
419407 getStackSpecificAppsStub . restore ( ) ;
420408 getAppManifestAndAppConfigStub . restore ( ) ;
@@ -785,11 +773,11 @@ describe('ExportMarketplaceApps', () => {
785773 } ) ;
786774
787775 // Reset the stub call count since it was called in beforeEach
788- ( utils . createNodeCryptoInstance as sinon . SinonStub ) . resetHistory ( ) ;
776+ ( marketplaceAppHelper . createNodeCryptoInstance as sinon . SinonStub ) . resetHistory ( ) ;
789777
790778 await exportMarketplaceApps . getAppConfigurations ( 0 , exportMarketplaceApps . installedApps [ 0 ] ) ;
791779
792- expect ( ( utils . createNodeCryptoInstance as sinon . SinonStub ) . called ) . to . be . true ;
780+ expect ( ( marketplaceAppHelper . createNodeCryptoInstance as sinon . SinonStub ) . called ) . to . be . true ;
793781 expect ( exportMarketplaceApps . nodeCrypto ) . to . exist ;
794782 expect ( ( marketplaceAppHelper . createNodeCryptoInstance as sinon . SinonStub ) . called ) . to . be . true ;
795783 } ) ;
0 commit comments