MCPcopy Index your code
hub / github.com/segmentio/evergreen / buildFile

Function buildFile

src/test/utils.js:9–22  ·  view source on GitHub ↗
(overrides = {})

Source from the content-addressed store, hash-verified

7 * @returns {File}
8 */
9export const buildFile = (overrides = {}) => {
10 const maxSizeInBytes = 10 * 1024 ** 2
11 const {
12 name = faker.system.fileName(),
13 size = faker.datatype.number({ min: 1024, max: 1024 * 3 }),
14 type = MimeType.gif
15 } = overrides
16
17 // Allocate an array the given size, but set a reasonable ceiling for testing
18 const file = new File(Buffer.alloc(Math.min(size, maxSizeInBytes)), name, {
19 type
20 })
21 return file
22}
23
24/**
25 * Builds a collection of `File` objects for testing

Callers 4

buildFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected