11import { bundleAndBuildExtensions } from './bundle.js'
22import { testApp , testFunctionExtension , testThemeExtensions , testUIExtension } from '../../models/app/app.test-data.js'
3- import { AppInterface } from '../../models/app/app.js'
3+ import { AppInterface , AppManifest } from '../../models/app/app.js'
44import * as bundle from '../bundle.js'
55import * as functionBuild from '../function/build.js'
66import { describe , expect , test , vi } from 'vitest'
@@ -11,6 +11,7 @@ vi.mock('../function/build.js')
1111
1212describe ( 'bundleAndBuildExtensions' , ( ) => {
1313 let app : AppInterface
14+ let appManifest : AppManifest
1415
1516 test ( 'generates a manifest.json' , async ( ) => {
1617 await file . inTemporaryDirectory ( async ( tmpDir : string ) => {
@@ -36,39 +37,21 @@ describe('bundleAndBuildExtensions', () => {
3637 extensionIds : { } ,
3738 extensionsNonUuidManaged : { } ,
3839 }
39- const expectedManifest = {
40- name : 'App' ,
41- handle : '' ,
42- modules : [
43- {
44- type : 'web_pixel_extension_external' ,
45- handle : 'test-ui-extension' ,
46- uid : 'test-ui-extension-uid' ,
47- assets : 'test-ui-extension-uid' ,
48- target : '' ,
49- config : { } ,
50- } ,
51- {
52- type : 'theme_external' ,
53- handle : 'theme-extension-name' ,
54- uid : themeExtension . uid ,
55- assets : themeExtension . uid ,
56- target : '' ,
57- config : {
58- theme_extension : {
59- files : { } ,
60- } ,
61- } ,
62- } ,
63- ] ,
64- }
40+ appManifest = await app . manifest ( identifiers )
6541
6642 // When
67- await bundleAndBuildExtensions ( { app, identifiers, bundlePath, skipBuild : false , isDevDashboardApp : false } )
43+ await bundleAndBuildExtensions ( {
44+ app,
45+ appManifest,
46+ identifiers,
47+ bundlePath,
48+ skipBuild : false ,
49+ isDevDashboardApp : false ,
50+ } )
6851
6952 // Then
7053 expect ( extensionBundleMock ) . toHaveBeenCalledTimes ( 2 )
71- expect ( bundle . writeManifestToBundle ) . toHaveBeenCalledWith ( app , bundleDirectory , identifiers )
54+ expect ( bundle . writeManifestToBundle ) . toHaveBeenCalledWith ( appManifest , bundleDirectory )
7255
7356 await expect ( file . fileExists ( bundlePath ) ) . resolves . toBeTruthy ( )
7457 } )
@@ -96,9 +79,17 @@ describe('bundleAndBuildExtensions', () => {
9679 extensionIds : { } ,
9780 extensionsNonUuidManaged : { } ,
9881 }
82+ appManifest = await app . manifest ( identifiers )
9983
10084 // When
101- await bundleAndBuildExtensions ( { app, identifiers, bundlePath, skipBuild : false , isDevDashboardApp : false } )
85+ await bundleAndBuildExtensions ( {
86+ app,
87+ appManifest,
88+ identifiers,
89+ bundlePath,
90+ skipBuild : false ,
91+ isDevDashboardApp : false ,
92+ } )
10293
10394 // Then
10495 await expect ( file . fileExists ( bundlePath ) ) . resolves . toBeTruthy ( )
@@ -129,9 +120,17 @@ describe('bundleAndBuildExtensions', () => {
129120 extensionIds : { } ,
130121 extensionsNonUuidManaged : { } ,
131122 }
123+ appManifest = await app . manifest ( identifiers )
132124
133125 // When
134- await bundleAndBuildExtensions ( { app, identifiers, bundlePath, skipBuild : true , isDevDashboardApp : false } )
126+ await bundleAndBuildExtensions ( {
127+ app,
128+ appManifest,
129+ identifiers,
130+ bundlePath,
131+ skipBuild : true ,
132+ isDevDashboardApp : false ,
133+ } )
135134
136135 // Then
137136 expect ( extensionBuildMock ) . not . toHaveBeenCalled ( )
@@ -159,9 +158,17 @@ describe('bundleAndBuildExtensions', () => {
159158 extensionIds : { } ,
160159 extensionsNonUuidManaged : { } ,
161160 }
161+ appManifest = await app . manifest ( identifiers )
162162
163163 // When
164- await bundleAndBuildExtensions ( { app, identifiers, bundlePath, skipBuild : true , isDevDashboardApp : false } )
164+ await bundleAndBuildExtensions ( {
165+ app,
166+ appManifest,
167+ identifiers,
168+ bundlePath,
169+ skipBuild : true ,
170+ isDevDashboardApp : false ,
171+ } )
165172
166173 // Then
167174 expect ( mockInstallJavy ) . not . toHaveBeenCalled ( )
@@ -187,9 +194,17 @@ describe('bundleAndBuildExtensions', () => {
187194 extensionIds : { } ,
188195 extensionsNonUuidManaged : { } ,
189196 }
197+ appManifest = await app . manifest ( identifiers )
190198
191199 // When
192- await bundleAndBuildExtensions ( { app, identifiers, bundlePath, skipBuild : false , isDevDashboardApp : false } )
200+ await bundleAndBuildExtensions ( {
201+ app,
202+ appManifest,
203+ identifiers,
204+ bundlePath,
205+ skipBuild : false ,
206+ isDevDashboardApp : false ,
207+ } )
193208
194209 // Then
195210 expect ( mockInstallJavy ) . toHaveBeenCalledWith ( app )
@@ -220,9 +235,17 @@ describe('bundleAndBuildExtensions', () => {
220235 extensionIds : { } ,
221236 extensionsNonUuidManaged : { } ,
222237 }
238+ appManifest = await app . manifest ( identifiers )
223239
224240 // When
225- await bundleAndBuildExtensions ( { app, identifiers, bundlePath, skipBuild : true , isDevDashboardApp : false } )
241+ await bundleAndBuildExtensions ( {
242+ app,
243+ appManifest,
244+ identifiers,
245+ bundlePath,
246+ skipBuild : true ,
247+ isDevDashboardApp : false ,
248+ } )
226249
227250 // Then
228251 expect ( extensionBuildMock ) . not . toHaveBeenCalled ( )
@@ -280,9 +303,17 @@ describe('bundleAndBuildExtensions', () => {
280303 extensionIds : { } ,
281304 extensionsNonUuidManaged : { } ,
282305 }
306+ appManifest = await app . manifest ( identifiers )
283307
284308 // When
285- await bundleAndBuildExtensions ( { app, identifiers, bundlePath, skipBuild : true , isDevDashboardApp : false } )
309+ await bundleAndBuildExtensions ( {
310+ app,
311+ appManifest,
312+ identifiers,
313+ bundlePath,
314+ skipBuild : true ,
315+ isDevDashboardApp : false ,
316+ } )
286317
287318 // Then - verify none of the build methods were called
288319 expect ( functionBuildMock ) . not . toHaveBeenCalled ( )
0 commit comments