fix: isolate downloads stats state

This commit is contained in:
Thomas Camlong committed 2026-08-14 22:07:12 +02:00
1 parent 2e3e654748
commit 3c533f2d96
4 files changed
+42 -10

No files matched your search

@@ -5,6 +5,7 @@ import {
filterDownloadItemsByStatus,
getAvailableDownloadStates,
getDownloadColumnAccessors,
getDownloadsStatsDisplay,
} from "./helpers";
describe("downloads filters", () => {
@@ -29,3 +30,22 @@ describe("downloads advanced columns", () => {
expect(getDownloadColumnAccessors(["name"], false)).toEqual(["name"]);
});
});
describe("downloads stats display", () => {
test("keeps advanced stats independent from the compact toggle", () => {
const compactStatsVisible = false;
expect(
[true, false, true, false].map((isAdvanced) => getDownloadsStatsDisplay(compactStatsVisible, isAdvanced)),
).toEqual([
{ visible: true, canToggle: false },
{ visible: false, canToggle: true },
{ visible: true, canToggle: false },
{ visible: false, canToggle: true },
]);
});
test("preserves an explicitly enabled compact stats bar", () => {
expect(getDownloadsStatsDisplay(true, false)).toEqual({ visible: true, canToggle: true });
});
});