From f87f8235bdfff91d0d5e267fe3041a9c78097616 Mon Sep 17 00:00:00 2001 From: mirivlad Date: Sat, 27 Jun 2026 13:39:48 +0800 Subject: [PATCH] Expand real sync smoke for folders --- internal/api/sync_real_server_test.go | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/internal/api/sync_real_server_test.go b/internal/api/sync_real_server_test.go index 8dad1f7..b17a8da 100644 --- a/internal/api/sync_real_server_test.go +++ b/internal/api/sync_real_server_test.go @@ -55,6 +55,36 @@ func TestSyncNowAgainstRealServerTwoVaults(t *testing.T) { if _, errStr := appB.GetVaultFileMetadata("files.plugin", "Shared/two.txt"); !strings.Contains(errStr, "not-found") { t.Fatalf("appB deleted file metadata err = %q, want not-found", errStr) } + + if errStr := appB.CreateVaultFolder("files.plugin", "Shared/Folder"); errStr != "" { + t.Fatalf("appB create folder: %s", errStr) + } + expectSyncCounts(t, appB, 1, 1) + expectSyncCounts(t, appA, 0, 1) + if meta, errStr := appA.GetVaultFileMetadata("files.plugin", "Shared/Folder"); errStr != "" || meta.Type != corefiles.FileTypeFolder { + t.Fatalf("appA folder metadata = %+v err=%q, want folder", meta, errStr) + } + + if errStr := appA.MoveVaultPath("files.plugin", "Shared/Folder", "Shared/Archive", corefiles.MoveOptions{}); errStr != "" { + t.Fatalf("appA move folder: %s", errStr) + } + expectSyncCounts(t, appA, 1, 1) + expectSyncCounts(t, appB, 0, 1) + if _, errStr := appB.GetVaultFileMetadata("files.plugin", "Shared/Folder"); !strings.Contains(errStr, "not-found") { + t.Fatalf("appB moved folder old metadata err = %q, want not-found", errStr) + } + if meta, errStr := appB.GetVaultFileMetadata("files.plugin", "Shared/Archive"); errStr != "" || meta.Type != corefiles.FileTypeFolder { + t.Fatalf("appB moved folder metadata = %+v err=%q, want folder", meta, errStr) + } + + if _, errStr := appB.TrashVaultPath("files.plugin", "Shared/Archive"); errStr != "" { + t.Fatalf("appB trash folder: %s", errStr) + } + expectSyncCounts(t, appB, 1, 1) + expectSyncCounts(t, appA, 0, 1) + if _, errStr := appA.GetVaultFileMetadata("files.plugin", "Shared/Archive"); !strings.Contains(errStr, "not-found") { + t.Fatalf("appA deleted folder metadata err = %q, want not-found", errStr) + } } func expectSyncCounts(t *testing.T, app *App, pushed, pulled int) {