Skip to content

Commit d142289

Browse files
committed
merge fix
1 parent 58e0f37 commit d142289

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

packages/filesystem/webdav/webdav.test.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,27 @@ describe("WebDAVFileSystem", () => {
186186
expect(mockClient.deleteFile).toHaveBeenCalledWith("/test.txt");
187187
});
188188

189+
it("normalizes double slashes in paths", async () => {
190+
const fs = WebDAVFileSystem.fromSameClient(
191+
{ client: mockClient, url: "https://dav.example.com", basePath: "/ScriptCat//sync" } as any,
192+
"/ScriptCat//sync"
193+
);
194+
195+
await fs.delete("dir//file.user.js");
196+
197+
expect(mockClient.deleteFile).toHaveBeenCalledWith("/ScriptCat/sync/dir/file.user.js");
198+
});
199+
200+
it("应当在 404 时静默成功(幂等删除)", async () => {
201+
(mockClient.deleteFile as ReturnType<typeof vi.fn>).mockRejectedValue({
202+
response: { status: 404 },
203+
message: "404 Not Found",
204+
});
205+
const fs = createTestFS(mockClient);
206+
207+
await expect(fs.delete("missing.txt")).resolves.toBeUndefined();
208+
});
209+
189210
it("应当在条件删除时发送 If-Match", async () => {
190211
const fs = createTestFS(mockClient);
191212

@@ -207,26 +228,6 @@ describe("WebDAVFileSystem", () => {
207228
provider: "webdav",
208229
conflict: true,
209230
});
210-
it("normalizes double slashes in paths", async () => {
211-
const fs = WebDAVFileSystem.fromSameClient(
212-
{ client: mockClient, url: "https://dav.example.com", basePath: "/ScriptCat//sync" } as any,
213-
"/ScriptCat//sync"
214-
);
215-
216-
await fs.delete("dir//file.user.js");
217-
218-
expect(mockClient.deleteFile).toHaveBeenCalledWith("/ScriptCat/sync/dir/file.user.js");
219-
});
220-
221-
it("应当在 404 时静默成功(幂等删除)", async () => {
222-
(mockClient.deleteFile as ReturnType<typeof vi.fn>).mockRejectedValue({
223-
response: { status: 404 },
224-
message: "404 Not Found",
225-
});
226-
const fs = createTestFS(mockClient);
227-
228-
await expect(fs.delete("missing.txt")).resolves.toBeUndefined();
229-
});
230231
});
231232

232233
describe("create", () => {

0 commit comments

Comments
 (0)