Fix testing setup
This commit is contained in:
parent
0897f7a545
commit
3784418567
11 changed files with 266 additions and 119 deletions
|
|
@ -333,16 +333,19 @@ export class MockAgent extends MockClient {
|
|||
.includes(content);
|
||||
});
|
||||
|
||||
if (
|
||||
!this.useSlowFileEvents
|
||||
|
||||
) {
|
||||
if (!this.useSlowFileEvents) {
|
||||
assert(
|
||||
found.length <= 1,
|
||||
`[${this.name}] Binary content ${content} found in multiple files: ${found.join(", ")}`
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.useSlowFileEvents && !this.doDeletes) {
|
||||
assert(
|
||||
found.length >= 1,
|
||||
`[${this.name}] Binary content ${content} not found in any files`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -510,9 +513,7 @@ export class MockAgent extends MockClient {
|
|||
`Decided to update binary file ${file}`
|
||||
);
|
||||
this.doNotTouchWhileOffline.push(file);
|
||||
this.files.set(file, bytes);
|
||||
|
||||
|
||||
await this.write(file, bytes);
|
||||
}
|
||||
|
||||
private async deleteFileAction(): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -45,10 +45,18 @@ export class MockClient extends debugging.InMemoryFileSystem {
|
|||
path: RelativePath,
|
||||
content: Uint8Array
|
||||
): Promise<void> {
|
||||
const isNew = !this.files.has(path);
|
||||
|
||||
this.files.set(path, content);
|
||||
this.executeFileOperation(
|
||||
async () => this.client.syncLocallyUpdatedFile({ relativePath: path }),
|
||||
);
|
||||
|
||||
if (isNew) {
|
||||
this.executeFileOperation(async () => { this.client.syncLocallyCreatedFile(path); }
|
||||
);
|
||||
} else {
|
||||
this.executeFileOperation(
|
||||
async () => { this.client.syncLocallyUpdatedFile({ relativePath: path }); },
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +74,7 @@ export class MockClient extends debugging.InMemoryFileSystem {
|
|||
this.files.set(path, newContentUint8Array);
|
||||
|
||||
this.executeFileOperation(
|
||||
async () => this.client.syncLocallyUpdatedFile({ relativePath: path }),
|
||||
async () => { this.client.syncLocallyUpdatedFile({ relativePath: path }); },
|
||||
);
|
||||
|
||||
return newContent;
|
||||
|
|
@ -77,7 +85,7 @@ export class MockClient extends debugging.InMemoryFileSystem {
|
|||
public override async delete(path: RelativePath): Promise<void> {
|
||||
this.files.delete(path);
|
||||
this.executeFileOperation(
|
||||
async () => this.client.syncLocallyDeletedFile(path),
|
||||
async () => { this.client.syncLocallyDeletedFile(path); },
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -94,10 +102,10 @@ export class MockClient extends debugging.InMemoryFileSystem {
|
|||
this.files.delete(oldPath);
|
||||
}
|
||||
this.executeFileOperation(
|
||||
async () => this.client.syncLocallyUpdatedFile({
|
||||
async () => { this.client.syncLocallyUpdatedFile({
|
||||
oldPath,
|
||||
relativePath: newPath
|
||||
}),
|
||||
}); },
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue