mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-03-22 15:08:22 +08:00
fix(webdav): only show auto-sync callout for auto-source errors
This commit is contained in:
@@ -449,9 +449,7 @@ export function WebdavSyncSection({ config }: WebdavSyncSectionProps) {
|
||||
: null;
|
||||
const lastError = config?.status?.lastError?.trim();
|
||||
const showAutoSyncError =
|
||||
!!lastError &&
|
||||
(config?.status?.lastErrorSource === "auto" ||
|
||||
(!config?.status?.lastErrorSource && !!config?.autoSync));
|
||||
!!lastError && config?.status?.lastErrorSource === "auto";
|
||||
|
||||
// ─── Render ─────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -155,6 +155,34 @@ describe("WebdavSyncSection", () => {
|
||||
expect(screen.getByText("network timeout")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("does not show auto sync error callout for manual sync errors", () => {
|
||||
renderSection({
|
||||
...baseConfig,
|
||||
status: {
|
||||
lastError: "manual upload failed",
|
||||
lastErrorSource: "manual",
|
||||
},
|
||||
});
|
||||
|
||||
expect(
|
||||
screen.queryByText("settings.webdavSync.autoSyncLastErrorTitle"),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("does not show auto sync error callout when source is missing", () => {
|
||||
renderSection({
|
||||
...baseConfig,
|
||||
autoSync: true,
|
||||
status: {
|
||||
lastError: "legacy error without source",
|
||||
},
|
||||
});
|
||||
|
||||
expect(
|
||||
screen.queryByText("settings.webdavSync.autoSyncLastErrorTitle"),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows validation error when saving without base url", async () => {
|
||||
renderSection({ ...baseConfig, baseUrl: "" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user