@@ -4,7 +4,6 @@ import path from "node:path";
44import { afterEach , describe , expect , it } from "vitest" ;
55import { ProjectStructure } from "../common/src/project/structure.js" ;
66import {
7- applyReverseProxyOverride ,
87 buildReverseProxyOverride ,
98 updateConfigYaml ,
109 updateViteConfig ,
@@ -278,7 +277,7 @@ export default defineConfig({
278277 } ) ;
279278} ) ;
280279
281- describe ( "applyReverseProxyOverride " , ( ) => {
280+ describe ( "ProjectStructure.init with a reverse proxy override " , ( ) => {
282281 const previousCwd = process . cwd ( ) ;
283282
284283 afterEach ( ( ) => {
@@ -302,12 +301,7 @@ describe("applyReverseProxyOverride", () => {
302301 ) ;
303302 process . chdir ( tempDir ) ;
304303
305- const reverseProxyOverride = buildReverseProxyOverride ( "www.brand.com/locations" ) ;
306- const projectStructure = await ProjectStructure . init ( {
307- scope : "brand" ,
308- reverseProxyPrefix : reverseProxyOverride . reverseProxyPrefix ,
309- } ) ;
310- applyReverseProxyOverride ( projectStructure , reverseProxyOverride ) ;
304+ await ProjectStructure . init ( { scope : "brand" } , "www.brand.com/locations" ) ;
311305
312306 expect ( fs . readFileSync ( path . join ( tempDir , "brand" , "config.yaml" ) , "utf-8" ) ) . toContain (
313307 "reverseProxyPrefix: www.brand.com/locations"
@@ -338,12 +332,9 @@ describe("applyReverseProxyOverride", () => {
338332 ) ;
339333 process . chdir ( tempDir ) ;
340334
341- const reverseProxyOverride = buildReverseProxyOverride ( "www.brand.com/locations" ) ;
342- const projectStructure = await ProjectStructure . init ( {
343- scope : "brand" ,
344- reverseProxyPrefix : reverseProxyOverride . reverseProxyPrefix ,
345- } ) ;
346- expect ( ( ) => applyReverseProxyOverride ( projectStructure , reverseProxyOverride ) ) . not . toThrow ( ) ;
335+ await expect (
336+ ProjectStructure . init ( { scope : "brand" } , "www.brand.com/locations" )
337+ ) . resolves . toBeDefined ( ) ;
347338 expect ( fs . readFileSync ( path . join ( tempDir , "vite.config.js" ) , "utf-8" ) ) . toContain (
348339 'assetsDir: "locations/assets"'
349340 ) ;
@@ -360,14 +351,9 @@ describe("applyReverseProxyOverride", () => {
360351 fs . writeFileSync ( path . join ( tempDir , "vite.config.js" ) , "export default { build: {} };\n" ) ;
361352 process . chdir ( tempDir ) ;
362353
363- const reverseProxyOverride = buildReverseProxyOverride ( "www.brand.com/locations" ) ;
364- const projectStructure = await ProjectStructure . init ( {
365- scope : "brand" ,
366- reverseProxyPrefix : reverseProxyOverride . reverseProxyPrefix ,
367- } ) ;
368- expect ( ( ) => applyReverseProxyOverride ( projectStructure , reverseProxyOverride ) ) . toThrow (
369- / c o n f i g \. y a m l d o e s n o t e x i s t /
370- ) ;
354+ await expect (
355+ ProjectStructure . init ( { scope : "brand" } , "www.brand.com/locations" )
356+ ) . rejects . toThrow ( / c o n f i g \. y a m l d o e s n o t e x i s t / ) ;
371357 } finally {
372358 fs . rmSync ( tempDir , { recursive : true , force : true } ) ;
373359 }
0 commit comments