Add attachment support to mock tests
This commit is contained in:
parent
6940c532ea
commit
9010245083
6 changed files with 252 additions and 11 deletions
|
@ -158,14 +158,17 @@ export class Bootstrap {
|
|||
private privDesktop?: Device;
|
||||
private storagePath?: string;
|
||||
private backupPath?: string;
|
||||
private cdn3Path: string;
|
||||
private timestamp: number = Date.now() - durations.WEEK;
|
||||
private lastApp?: App;
|
||||
private readonly randomId = crypto.randomBytes(8).toString('hex');
|
||||
|
||||
constructor(options: BootstrapOptions = {}) {
|
||||
this.cdn3Path = path.join(os.tmpdir(), 'mock-signal-cdn3-');
|
||||
this.server = new Server({
|
||||
// Limit number of storage read keys for easier testing
|
||||
maxStorageReadKeys: MAX_STORAGE_READ_KEYS,
|
||||
cdn3Path: this.cdn3Path,
|
||||
});
|
||||
|
||||
this.options = {
|
||||
|
@ -286,12 +289,9 @@ export class Bootstrap {
|
|||
|
||||
await Promise.race([
|
||||
Promise.all([
|
||||
this.storagePath
|
||||
? fs.rm(this.storagePath, { recursive: true })
|
||||
: Promise.resolve(),
|
||||
this.backupPath
|
||||
? fs.rm(this.backupPath, { recursive: true })
|
||||
: Promise.resolve(),
|
||||
...[this.storagePath, this.backupPath, this.cdn3Path].map(tmpPath =>
|
||||
tmpPath ? fs.rm(tmpPath, { recursive: true }) : Promise.resolve()
|
||||
),
|
||||
this.server.close(),
|
||||
this.lastApp?.close(),
|
||||
]),
|
||||
|
@ -649,6 +649,7 @@ export class Bootstrap {
|
|||
cdn: {
|
||||
'0': url,
|
||||
'2': url,
|
||||
'3': `${url}/cdn3`,
|
||||
},
|
||||
updatesEnabled: false,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue