More test improvements

This commit is contained in:
Andras Schmelczer 2026-04-25 23:26:41 +01:00
parent 56070912e8
commit fe2b4751bd
6 changed files with 8 additions and 49 deletions

View file

@ -52,7 +52,6 @@ import { updateDoesNotSurvivesRemoteDeleteTest } from "./tests/update-survives-r
import { movePreservesRemoteUpdateTest } from "./tests/move-preserves-remote-update.test";
import { recentlyDeletedClearedOnReconnectTest } from "./tests/recently-deleted-cleared-on-reconnect.test";
import { migrateKeyPreservesExistingTest } from "./tests/migrate-key-preserves-existing.test";
import { failedVfsMoveFallsBackTest } from "./tests/failed-vfs-move-falls-back.test";
import { watermarkAdvancesOnSkipTest } from "./tests/watermark-advances-on-skip.test";
import { watermarkGapRemoteUpdateNotRecordedTest } from "./tests/watermark-gap-remote-update-not-recorded.test";
import { queueResetLosesCoalescedLocalEditTest } from "./tests/queue-reset-loses-coalesced-local-edit.test";
@ -151,7 +150,6 @@ export const TESTS: Partial<Record<string, TestDefinition>> = {
"recently-deleted-cleared-on-reconnect":
recentlyDeletedClearedOnReconnectTest,
"migrate-key-preserves-existing": migrateKeyPreservesExistingTest,
"failed-vfs-move-falls-back": failedVfsMoveFallsBackTest,
"watermark-advances-on-skip": watermarkAdvancesOnSkipTest,
"watermark-gap-remote-update-not-recorded":
watermarkGapRemoteUpdateNotRecordedTest,

View file

@ -4,8 +4,7 @@ import type { TestDefinition } from "../test-definition";
export const concurrentRenameAndCreateAtTargetTest: TestDefinition = {
description:
"One client renames X to Y while another creates a new file at Y, " +
"both offline. After syncing, Y should contain merged content from " +
"both the renamed file and the newly created file.",
"both offline. We can't merge the create because it would result in a cycle",
clients: 2,
steps: [
{
@ -14,8 +13,6 @@ 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 },
@ -41,11 +38,13 @@ export const concurrentRenameAndCreateAtTargetTest: TestDefinition = {
verify: (state: AssertableState): void => {
state
.assertFileNotExists("X.md")
.assertContains(
.assertFileExists(
"Y.md",
"original file X",
"brand new Y content"
);
)
.assertFileExists(
"Y (1).md",
)
.assertAnyFileContains("original file X", "brand new Y content")
}
}
]

View file

@ -9,8 +9,6 @@ export const createRenameResponseSkipsFileTest: TestDefinition = {
steps: [
{ type: "enable-sync", client: 0 },
{ type: "enable-sync", client: 1 },
{ type: "sync" },
{ type: "barrier" },
{
type: "create",
@ -26,8 +24,6 @@ export const createRenameResponseSkipsFileTest: TestDefinition = {
newPath: "renamed.md"
},
{ type: "sync" },
{ type: "sync" },
{ type: "barrier" },
{

View file

@ -1,28 +0,0 @@
import type { AssertableState } from "../utils/assertable-state";
import type { TestDefinition } from "../test-definition";
export const failedVfsMoveFallsBackTest: TestDefinition = {
description:
"File A is renamed to B's path (overwriting B). Both clients " +
"should converge on a single file at B.md with A's content.",
clients: 2,
steps: [
{ type: "create", client: 0, path: "A.md", content: "content A" },
{ type: "create", client: 0, path: "B.md", content: "content B" },
{ type: "enable-sync", client: 0 },
{ type: "enable-sync", client: 1 },
{ type: "sync" },
{ type: "barrier" },
{ type: "rename", client: 0, oldPath: "A.md", newPath: "B.md" },
{ type: "sync" },
{ type: "barrier" },
{
type: "assert-consistent",
verify: (s: AssertableState): void => {
s.assertFileCount(1).assertContent("B.md", "content A");
}
}
]
};

View file

@ -24,9 +24,7 @@ export const onlineEditVsDeleteConvergenceTest: TestDefinition = {
{
type: "assert-consistent",
verify: (state: AssertableState): void => {
state.ifFileExists("A.md", (s) =>
s.assertContainsAny("A.md", "edited by client 0")
);
state.assertFileCount(0);
}
}
]

View file

@ -8,8 +8,6 @@ export const renamePendingCreateBeforeResponseTest: TestDefinition = {
steps: [
{ type: "enable-sync", client: 0 },
{ type: "enable-sync", client: 1 },
{ type: "sync" },
{ type: "barrier" },
{ type: "pause-server" },
@ -29,8 +27,6 @@ export const renamePendingCreateBeforeResponseTest: TestDefinition = {
{ type: "resume-server" },
{ type: "sync" },
{ type: "sync" },
{ type: "barrier" },
{