Revie ai fixes
This commit is contained in:
parent
fe2b4751bd
commit
8eae770621
12 changed files with 287 additions and 121 deletions
|
|
@ -15,6 +15,13 @@ export const createMergePreservesRenamedUpdateTest: TestDefinition = {
|
|||
{ type: "enable-sync", client: 1 },
|
||||
{ type: "barrier" },
|
||||
|
||||
{
|
||||
type: "assert-consistent",
|
||||
verify: (state: AssertableState): void => {
|
||||
state.assertContains("doc.md", "alpha", "beta");
|
||||
}
|
||||
},
|
||||
|
||||
{ type: "disable-sync", client: 1 },
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ export const concurrentRenameAndCreateAtTargetTest: TestDefinition = {
|
|||
path: "X.md",
|
||||
content: "original file X"
|
||||
},
|
||||
{ type: "enable-sync", client: 0 },
|
||||
{ type: "enable-sync", client: 1 },
|
||||
{ type: "barrier" },
|
||||
|
||||
{ type: "disable-sync", client: 0 },
|
||||
|
|
|
|||
|
|
@ -39,8 +39,9 @@ export const onlineCreateUpdateWhileOtherCreatesSamePathTest: TestDefinition = {
|
|||
verify: (state: AssertableState): void => {
|
||||
state
|
||||
.assertFileCount(2)
|
||||
.assertContains("data.bin", "content-v2")
|
||||
.assertContains("data (1).bin", "other-content");
|
||||
.assertNoFileContains("content-v1")
|
||||
.assertAnyFileContains("content-v2")
|
||||
.assertAnyFileContains("other-content");
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -16,13 +16,9 @@ export const resetClearsRecentlyDeletedResurrectionTest: TestDefinition = {
|
|||
},
|
||||
{ type: "enable-sync", client: 0 },
|
||||
{ type: "enable-sync", client: 1 },
|
||||
{ type: "sync" },
|
||||
{ type: "barrier" },
|
||||
|
||||
{ type: "delete", client: 0, path: "ghost.md" },
|
||||
{ type: "sync", client: 0 },
|
||||
|
||||
{ type: "sync" },
|
||||
{ type: "barrier" },
|
||||
|
||||
{
|
||||
|
|
@ -34,7 +30,7 @@ export const resetClearsRecentlyDeletedResurrectionTest: TestDefinition = {
|
|||
|
||||
{ type: "disable-sync", client: 1 },
|
||||
{ type: "enable-sync", client: 1 },
|
||||
{ type: "sync" },
|
||||
|
||||
{ type: "barrier" },
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ export const serverPauseUpdateAndCreateTest: TestDefinition = {
|
|||
path: "shared.md",
|
||||
content: "initial content"
|
||||
},
|
||||
{ type: "sync" },
|
||||
{ type: "barrier" },
|
||||
{
|
||||
type: "assert-consistent",
|
||||
|
|
@ -40,7 +39,6 @@ export const serverPauseUpdateAndCreateTest: TestDefinition = {
|
|||
|
||||
{ type: "resume-server" },
|
||||
|
||||
{ type: "sync" },
|
||||
{ type: "barrier" },
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,6 +86,26 @@ export class AssertableState {
|
|||
return this;
|
||||
}
|
||||
|
||||
public assertNoFileContains(...substrings: string[]): this {
|
||||
const offenders: { path: string; substring: string }[] = [];
|
||||
for (const [path, content] of this.files) {
|
||||
for (const s of substrings) {
|
||||
if (content.includes(s)) {
|
||||
offenders.push({ path, substring: s });
|
||||
}
|
||||
}
|
||||
}
|
||||
if (offenders.length > 0) {
|
||||
const dump = Array.from(this.files.entries())
|
||||
.map(([k, v]) => ` ${k}: "${v}"`)
|
||||
.join("\n");
|
||||
throw new Error(
|
||||
`Expected no file to contain ${substrings.map((s) => `"${s}"`).join(", ")}, but found ${offenders.map((o) => `"${o.substring}" in "${o.path}"`).join(", ")}.\nFiles:\n${dump}`
|
||||
);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertSubstringCount(
|
||||
path: string,
|
||||
substring: string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue