File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: Apache-2.0
55 */
66
7+ import { randomBytes } from 'node:crypto' ;
78import { test } from 'uvu' ;
89import * as assert from 'uvu/assert' ;
910import { GitHubActionsCache } from '../caching/github-actions-cache.js' ;
4445 assert . is ( get1 , undefined ) ;
4546
4647 const filename = 'test' ;
47- const content = 'This is a test file!' ;
48+ const content = randomBytes ( 200 * 1024 ** 2 ) ;
4849 await rig . write ( filename , content ) ;
4950 const set1 = await cache . set ( script , fingerprint , [
5051 {
7273 assert . not ( await rig . exists ( 'test' ) ) ;
7374 await get2 . apply ( ) ;
7475 assert . ok ( await rig . exists ( 'test' ) ) ;
75- const actual = await rig . read ( 'test' ) ;
76+ const actual = await rig . readBytes ( 'test' ) ;
7677 console . log ( { actual} ) ;
7778 assert . equal ( actual , content ) ;
7879
Original file line number Diff line number Diff line change @@ -131,13 +131,21 @@ export class FilesystemTestRig {
131131 }
132132
133133 /**
134- * Read a file from the temporary filesystem.
134+ * Read a file from the temporary filesystem as UTF8 .
135135 */
136136 async read ( filename : string ) : Promise < string > {
137137 this . _assertState ( 'running' ) ;
138138 return fs . readFile ( this . resolve ( filename ) , 'utf8' ) ;
139139 }
140140
141+ /**
142+ * Read a file from the temporary filesystem as bytes.
143+ */
144+ async readBytes ( filename : string ) : Promise < Buffer < ArrayBufferLike > > {
145+ this . _assertState ( 'running' ) ;
146+ return fs . readFile ( this . resolve ( filename ) ) ;
147+ }
148+
141149 /**
142150 * Check whether a file exists in the temporary filesystem.
143151 */
You can’t perform that action at this time.
0 commit comments