Merge branch 'INDA-330-pii-update' into 'main'
[ProtonMail-WebClient.git] / applications / drive / src / app / utils / test / file.ts
blobbfc65e4a756a7a129a744f60ffb510e040f5e95d
1 export function mockGlobalFile() {
2     // @ts-ignore
3     global.File = class MockFile {
4         name: string;
6         size: number;
8         type: string;
10         parts: (string | Blob | ArrayBuffer | ArrayBufferView)[];
12         properties?: FilePropertyBag;
14         lastModified: number;
16         constructor(
17             parts: (string | Blob | ArrayBuffer | ArrayBufferView)[],
18             name: string,
19             properties?: FilePropertyBag
20         ) {
21             this.parts = parts;
22             this.name = name;
23             this.size = parts.join('').length;
24             this.type = 'txt';
25             this.properties = properties;
26             this.lastModified = 1234567890000; // Sat Feb 13 2009 23:31:30 GMT+0000.
27         }
28     };
31 export function testFile(filename: string, size: number = 42) {
32     return new File(['x'.repeat(size)], filename, undefined);