@@ -938,28 +938,23 @@ it.live.each([
938938 ) . pipe ( Effect . provide ( layer ) ) ,
939939) ;
940940
941- it . live . each ( [
942- { bytes : 5 , truncated : false } ,
943- { bytes : 8 * 1024 * 1024 , truncated : false } ,
944- { bytes : 8 * 1024 * 1024 , truncated : true } ,
945- ] ) (
946- "saves a recording of $bytes bytes and cleans up a truncated download ($truncated)" ,
947- ( { bytes, truncated } ) =>
941+ it . live . each ( [ { truncated : false } , { truncated : true } ] ) (
942+ "saves a large recording as a binary download and removes its staged file (truncated: $truncated)" ,
943+ ( { truncated } ) =>
948944 Effect . scoped (
949945 Effect . gen ( function * ( ) {
950946 const { broker, tabId } = yield * ready ;
951947 const fs = yield * FileSystem . FileSystem ;
948+ const bytes = 8 * 1024 * 1024 ;
952949 const payload = Buffer . alloc ( bytes , 0x5a ) ;
953- const large = bytes > 5 ;
954950 let stagedPath : string | undefined ;
955951 const download = Promise . withResolvers < { saveAs : ( path : string ) => Promise < void > } > ( ) ;
956952 const sandbox = NodeVM . createContext ( {
957953 __t3Recorder : {
958954 frame : async ( ) => true ,
959955 stop : async ( ) => ( { mimeType : "video/webm" , count : 1 , bytes } ) ,
960956 chunk : async ( ) => {
961- if ( large ) throw new Error ( "Large recording used Base64 export" ) ;
962- return payload . toString ( "base64" ) ;
957+ throw new Error ( "Large recording used Base64 export" ) ;
963958 } ,
964959 download : ( ) =>
965960 download . resolve ( {
@@ -995,10 +990,8 @@ it.live.each([
995990 expect ( artifact . sizeBytes ) . toBe ( bytes ) ;
996991 expect ( Buffer . from ( yield * fs . readFile ( artifact . path ) ) . equals ( payload ) ) . toBe ( true ) ;
997992 }
998- if ( large ) {
999- expect ( stagedPath ) . toBeDefined ( ) ;
1000- expect ( yield * fs . exists ( stagedPath ! ) ) . toBe ( false ) ;
1001- }
993+ expect ( stagedPath ) . toBeDefined ( ) ;
994+ expect ( yield * fs . exists ( stagedPath ! ) ) . toBe ( false ) ;
1002995 } ) ,
1003996 ) . pipe ( Effect . provide ( layer ) ) ,
1004997) ;
0 commit comments