@@ -73,6 +73,7 @@ const browserArchive = makeZip([
7373
7474const makeHarness = Effect . fn ( "test.makePreviewBrowser" ) ( function * (
7575 options : {
76+ readonly version ?: string ;
7677 readonly archive ?: Buffer ;
7778 readonly sha256 ?: string ;
7879 readonly body ?: Stream . Stream < Uint8Array > ;
@@ -93,7 +94,7 @@ const makeHarness = Effect.fn("test.makePreviewBrowser")(function* (
9394 release : options . unsupported
9495 ? null
9596 : {
96- version : "1.2.3" ,
97+ version : options . version ?? "1.2.3" ,
9798 platform : "fixture" ,
9899 url : "https://storage.googleapis.com/chrome-headless-shell-fixture.zip" ,
99100 bytes : archive . byteLength ,
@@ -121,10 +122,11 @@ const makeHarness = Effect.fn("test.makePreviewBrowser")(function* (
121122} ) ;
122123
123124it . layer ( NodeServices . layer ) ( "PreviewBrowser" , ( it ) => {
124- it . effect ( "installs a verified download with its file modes and then reuses it ", ( ) =>
125+ it . effect . each ( [ "0.8.0" , "1.2.3" ] ) ( "retains another version when installing %s ", ( current ) =>
125126 Effect . gen ( function * ( ) {
126- const { browser, fs, path, installRoot, requests } = yield * makeHarness ( ) ;
127- yield * fs . makeDirectory ( path . join ( installRoot , "1.0.0" ) , { recursive : true } ) ;
127+ const { browser, fs, path, installRoot, requests } = yield * makeHarness ( { version : current } ) ;
128+ yield * fs . makeDirectory ( path . join ( installRoot , "0.9.0" ) , { recursive : true } ) ;
129+ yield * fs . makeDirectory ( path . join ( installRoot , "0.10.0" ) ) ;
128130 const active = path . join ( installRoot , ".install-other" ) ;
129131 const abandoned = path . join ( installRoot , ".install-abandoned" ) ;
130132 yield * fs . makeDirectory ( active ) ;
@@ -135,7 +137,7 @@ it.layer(NodeServices.layer)("PreviewBrowser", (it) => {
135137
136138 const executable = yield * browser . executable ;
137139
138- const version = path . join ( installRoot , "1.2.3" ) ;
140+ const version = path . join ( installRoot , current ) ;
139141 expect ( executable ) . toBe ( path . join ( version , executableName ) ) ;
140142 expect ( yield * fs . readFileString ( path . join ( version , "locales" , "en-US.pak" ) ) ) . toBe ( "strings" ) ;
141143 if ( hostPlatform !== "win32" ) {
@@ -145,10 +147,9 @@ it.layer(NodeServices.layer)("PreviewBrowser", (it) => {
145147 expect ( yield * mode ( "libEGL.so" ) ) . toBe ( 0o755 ) ;
146148 expect ( yield * mode ( path . join ( "locales" , "en-US.pak" ) ) ) . toBe ( 0o644 ) ;
147149 }
148- expect ( ( yield * fs . readDirectory ( installRoot ) ) . toSorted ( ) ) . toEqual ( [
149- ".install-other" ,
150- "1.2.3" ,
151- ] ) ;
150+ expect ( ( yield * fs . readDirectory ( installRoot ) ) . toSorted ( ) ) . toEqual (
151+ [ ".install-other" , "0.10.0" , current ] . toSorted ( ) ,
152+ ) ;
152153 expect ( yield * browser . executable ) . toBe ( executable ) ;
153154 expect ( yield * browser . installed ) . toEqual ( Option . some ( executable ) ) ;
154155 expect ( requests ) . toHaveLength ( 1 ) ;
0 commit comments