@@ -15,6 +15,7 @@ const fixturesPath = path.join(__dirname, '../../../fixtures')
1515const collectionPath = path . join ( __dirname , '../../../fixtures/collection' )
1616const themePath = path . join ( __dirname , '../../../fixtures/theme' )
1717const testCollectionPath = path . join ( fixturesPath , 'test-collection' )
18+ const testCollectionBPath = path . join ( fixturesPath , 'test-collection-b' )
1819const testThemePath = path . join ( fixturesPath , 'test-theme' )
1920
2021describe ( 'theme component install' , ( ) => {
@@ -32,13 +33,15 @@ describe('theme component install', () => {
3233 generateRunStub = sandbox . stub ( GenerateImportMap . prototype , 'run' ) . resolves ( )
3334
3435 fs . cpSync ( collectionPath , testCollectionPath , { recursive : true } )
36+ fs . cpSync ( collectionPath , testCollectionBPath , { recursive : true } )
3537 fs . cpSync ( themePath , testThemePath , { recursive : true } )
3638 process . chdir ( testCollectionPath )
3739 } )
3840
3941 afterEach ( ( ) => {
4042 sandbox . restore ( )
4143 fs . rmSync ( testCollectionPath , { force : true , recursive : true } )
44+ fs . rmSync ( testCollectionBPath , { force : true , recursive : true } )
4245 fs . rmSync ( testThemePath , { force : true , recursive : true } )
4346 } )
4447
@@ -57,11 +60,16 @@ describe('theme component install', () => {
5760 expect ( cleanRunStub . calledOnce ) . to . be . true
5861 } )
5962
60- it ( 'runs the theme component generate import map command' , async ( ) => {
63+ it ( 'runs the theme component generate import map command if the destination is a theme repo ' , async ( ) => {
6164 await Install . run ( [ testThemePath ] )
6265 expect ( generateRunStub . calledOnce ) . to . be . true
6366 } )
6467
68+ it ( 'does not run the theme component generate import map command if the destination is not a theme repo' , async ( ) => {
69+ await Install . run ( [ testCollectionBPath ] )
70+ expect ( generateRunStub . calledOnce ) . to . be . false
71+ } )
72+
6573 it ( 'runs sub-commands in correct order' , async ( ) => {
6674 await Install . run ( [ testThemePath ] )
6775 sinon . assert . callOrder ( manifestRunStub , copyRunStub , cleanRunStub , generateRunStub )
0 commit comments