@@ -155,6 +155,8 @@ test.describe("Workspace Manager V2 bootstrap", () => {
155155 await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"source": "manifest"' ) ;
156156 await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"asset-manager-v2"' ) ;
157157 await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"palette-manager-v2"' ) ;
158+ await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"vector-map-editor"' ) ;
159+ await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"vector.asteroids.ship"' ) ;
158160 await expect ( page . locator ( "#workspaceContextOutput" ) ) . not . toContainText ( '"palette-browser"' ) ;
159161 await expect ( page . locator ( "#workspaceContextOutput" ) ) . not . toContainText ( '"asset-browser"' ) ;
160162 await expect ( page . locator ( "#workspaceContextOutput" ) ) . not . toContainText ( '"activePalette"' ) ;
@@ -174,11 +176,12 @@ test.describe("Workspace Manager V2 bootstrap", () => {
174176 const asteroidsManifest = await page . evaluate ( async ( ) => await fetch ( "/games/Asteroids/game.manifest.json" , { cache : "no-store" } ) . then ( ( response ) => response . json ( ) ) ) ;
175177 expect ( savedManifest ) . toEqual ( asteroidsManifest ) ;
176178 expect ( savedManifest . documentKind ) . toBe ( "workspace-manifest" ) ;
177- expect ( Object . keys ( savedManifest . tools ) . sort ( ) ) . toEqual ( [ "asset-manager-v2" , "palette-manager-v2" ] ) ;
179+ expect ( Object . keys ( savedManifest . tools ) . sort ( ) ) . toEqual ( [ "asset-manager-v2" , "palette-manager-v2" , "vector-map-editor" ] ) ;
178180 expect ( savedManifest . tools [ "palette-manager-v2" ] . swatches . length ) . toBeGreaterThan ( 0 ) ;
179181 expect ( Object . keys ( savedManifest . tools [ "asset-manager-v2" ] . assets ) ) . toHaveLength ( 13 ) ;
180182 expect ( savedManifest . tools [ "asset-manager-v2" ] . source ) . toBe ( "manifest" ) ;
181183 expect ( savedManifest . tools [ "asset-manager-v2" ] . schema ) . toBe ( "html-js-gaming.asset-manager-v2" ) ;
184+ expect ( savedManifest . tools [ "vector-map-editor" ] . vectorMapDocument . vectors . map ( ( vector ) => vector . id ) ) . toContain ( "vector.asteroids.ship" ) ;
182185 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K S a v e d s c h e m a - v a l i d W o r k s p a c e M a n a g e r V 2 m a n i f e s t w o r k s p a c e - m a n a g e r - v 2 - A s t e r o i d s \. / ) ;
183186
184187 await page . locator ( "#launchAssetManagerV2Button" ) . click ( ) ;
@@ -221,6 +224,7 @@ test.describe("Workspace Manager V2 bootstrap", () => {
221224 expect ( storedContext . assetsPath ) . toBe ( "games/Asteroids/assets" ) ;
222225 expect ( storedContext . tools [ "palette-manager-v2" ] . swatches . length ) . toBeGreaterThan ( 0 ) ;
223226 expect ( Object . keys ( storedContext . tools [ "asset-manager-v2" ] . assets ) ) . toHaveLength ( 13 ) ;
227+ expect ( storedContext . tools [ "vector-map-editor" ] . vectorMapDocument . vectors . map ( ( vector ) => vector . id ) ) . toContain ( "vector.asteroids.ship" ) ;
224228 expect ( storedContext . tools [ "asset-manager-v2" ] . assets [ "assets.font.ui.vector-battle" ] ) . toEqual ( {
225229 path : "assets/fonts/vector_battle.ttf" ,
226230 type : "font" ,
@@ -233,15 +237,17 @@ test.describe("Workspace Manager V2 bootstrap", () => {
233237 expect ( storedContext . tools [ "palette-browser" ] ) . toBeUndefined ( ) ;
234238 expect ( storedContext . tools [ "asset-manager-v2" ] . schema ) . toBe ( "html-js-gaming.asset-manager-v2" ) ;
235239 const schemaValidation = await page . evaluate ( async ( ) => {
236- const [ workspaceSchema , paletteSchema , assetSchema ] = await Promise . all ( [
240+ const [ workspaceSchema , paletteSchema , assetSchema , vectorMapSchema ] = await Promise . all ( [
237241 fetch ( "/tools/schemas/workspace.manifest.schema.json" , { cache : "no-store" } ) . then ( ( response ) => response . json ( ) ) ,
238242 fetch ( "/tools/schemas/tools/palette-manager-v2.schema.json" , { cache : "no-store" } ) . then ( ( response ) => response . json ( ) ) ,
239- fetch ( "/tools/schemas/tools/asset-manager-v2.schema.json" , { cache : "no-store" } ) . then ( ( response ) => response . json ( ) )
243+ fetch ( "/tools/schemas/tools/asset-manager-v2.schema.json" , { cache : "no-store" } ) . then ( ( response ) => response . json ( ) ) ,
244+ fetch ( "/tools/schemas/tools/vector-map-editor.schema.json" , { cache : "no-store" } ) . then ( ( response ) => response . json ( ) )
240245 ] ) ;
241246 const url = new URL ( window . location . href ) ;
242247 const manifest = JSON . parse ( sessionStorage . getItem ( url . searchParams . get ( "hostContextId" ) ) ) ;
243248 const palettePayload = manifest . tools [ "palette-manager-v2" ] ;
244249 const assetPayload = manifest . tools [ "asset-manager-v2" ] ;
250+ const vectorPayload = manifest . tools [ "vector-map-editor" ] ;
245251 const extraKeys = ( value , schema ) => Object . keys ( value ) . filter ( ( key ) => ! Object . hasOwn ( schema . properties || { } , key ) ) ;
246252 const missingKeys = ( value , schema ) => ( schema . required || [ ] ) . filter ( ( key ) => ! Object . hasOwn ( value , key ) ) ;
247253 const swatchExtraKeys = palettePayload . swatches . flatMap ( ( swatch , index ) => (
@@ -260,7 +266,10 @@ test.describe("Workspace Manager V2 bootstrap", () => {
260266 swatchExtraKeys,
261267 swatchMissingKeys,
262268 toolKeys : Object . keys ( manifest . tools ) . sort ( ) ,
263- unsupportedToolKeys : Object . keys ( manifest . tools ) . filter ( ( key ) => ! Object . hasOwn ( workspaceSchema . properties . tools . properties , key ) )
269+ unsupportedToolKeys : Object . keys ( manifest . tools ) . filter ( ( key ) => ! Object . hasOwn ( workspaceSchema . properties . tools . properties , key ) ) ,
270+ vectorExtraKeys : extraKeys ( vectorPayload , vectorMapSchema ) ,
271+ vectorMissingKeys : missingKeys ( vectorPayload , vectorMapSchema ) ,
272+ vectorIds : vectorPayload . vectorMapDocument . vectors . map ( ( vector ) => vector . id )
264273 } ;
265274 } ) ;
266275 expect ( schemaValidation ) . toEqual ( {
@@ -272,8 +281,17 @@ test.describe("Workspace Manager V2 bootstrap", () => {
272281 paletteMissingKeys : [ ] ,
273282 swatchExtraKeys : [ ] ,
274283 swatchMissingKeys : [ ] ,
275- toolKeys : [ "asset-manager-v2" , "palette-manager-v2" ] ,
276- unsupportedToolKeys : [ ]
284+ toolKeys : [ "asset-manager-v2" , "palette-manager-v2" , "vector-map-editor" ] ,
285+ unsupportedToolKeys : [ ] ,
286+ vectorExtraKeys : [ ] ,
287+ vectorIds : [
288+ "vector.asteroids.ship" ,
289+ "vector.asteroids.asteroid.large" ,
290+ "vector.asteroids.asteroid.medium" ,
291+ "vector.asteroids.asteroid.small" ,
292+ "vector.asteroids.ui.title"
293+ ] ,
294+ vectorMissingKeys : [ ]
277295 } ) ;
278296 expect ( JSON . stringify ( storedContext ) ) . not . toMatch ( / s a m p l e s \/ / i) ;
279297 await page . locator ( "#returnToWorkspaceButton" ) . click ( ) ;
@@ -313,6 +331,40 @@ test.describe("Workspace Manager V2 bootstrap", () => {
313331 }
314332 } ) ;
315333
334+ test ( "warns instead of injecting hardcoded Asteroids assets when manifest assets are empty" , async ( { page } ) => {
335+ const server = await startRepoServer ( ) ;
336+ const pageErrors = [ ] ;
337+ const asteroidsManifest = JSON . parse ( await readFile ( "games/Asteroids/game.manifest.json" , "utf8" ) ) ;
338+ asteroidsManifest . tools [ "asset-manager-v2" ] . assets = { } ;
339+
340+ page . on ( "pageerror" , ( error ) => {
341+ pageErrors . push ( error . message ) ;
342+ } ) ;
343+
344+ await page . route ( "**/games/Asteroids/game.manifest.json" , async ( route ) => {
345+ await route . fulfill ( {
346+ body : JSON . stringify ( asteroidsManifest ) ,
347+ contentType : "application/json" ,
348+ status : 200
349+ } ) ;
350+ } ) ;
351+ await coverageReporter . start ( page ) ;
352+ await page . goto ( `${ server . baseUrl } /tools/workspace-manager-v2/index.html` , { waitUntil : "networkidle" } ) ;
353+
354+ try {
355+ await page . locator ( "#activeGameSelect" ) . selectOption ( "Asteroids" ) ;
356+ await expect ( page . locator ( "#activeAssetRegistrySummary" ) ) . toHaveText ( "Schema-ready Asset Manager V2 manifest payload contains 0 managed assets." ) ;
357+ await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"assets": {}' ) ;
358+ await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"vector-map-editor"' ) ;
359+ await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / I N F O W a r n i n g : \/ g a m e s \/ A s t e r o i d s \/ g a m e \. m a n i f e s t \. j s o n h a s n o A s t e r o i d s A s s e t M a n a g e r V 2 a s s e t s ; W o r k s p a c e M a n a g e r V 2 d i d n o t i n j e c t h a r d c o d e d a s s e t s \. / ) ;
360+ await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K L o a d e d A s t e r o i d s f r o m \/ g a m e s \/ A s t e r o i d s \/ g a m e \. m a n i f e s t \. j s o n w i t h 1 1 a c t i v e p a l e t t e c o l o r s a n d 0 m a n a g e d a s s e t s \. / ) ;
361+ expect ( pageErrors ) . toEqual ( [ ] ) ;
362+ } finally {
363+ await coverageReporter . stop ( page ) ;
364+ await server . close ( ) ;
365+ }
366+ } ) ;
367+
316368 test ( "keeps direct Asset Manager V2 workspace prod launch blocked" , async ( { page } ) => {
317369 const server = await openAssetManagerV2 ( page , "?workspace=prod" ) ;
318370 const pageErrors = [ ] ;
0 commit comments