test(frontend): expand admin and viewer test coverage for auth, typing, reconnect, and playlist badges
This commit is contained in:
1 parent
68a4d35334
commit
02ff53229c
3 files changed
+209
-1
No files matched your search
@@ -326,3 +326,53 @@ describe("admin responsive layout", () => {
|
||||
expect(tabs).toContain("Dashboard");
|
||||
});
|
||||
});
|
||||
|
||||
describe("admin data refresh failures", () => {
|
||||
beforeEach(() => {
|
||||
document.body.innerHTML = `
|
||||
<div id="overview-status"></div>
|
||||
<div id="analytics-status"></div>
|
||||
`;
|
||||
});
|
||||
|
||||
it("sets error status when overview fails", async () => {
|
||||
mockFetchResponse = { ok: false, status: 500, payload: {} };
|
||||
await refreshOverview();
|
||||
expect(document.getElementById("overview-status")?.textContent).toContain("Failed");
|
||||
});
|
||||
|
||||
it("sets error status when analytics fails", async () => {
|
||||
mockFetchResponse = { ok: false, status: 500, payload: {} };
|
||||
await refreshAnalytics();
|
||||
expect(document.getElementById("analytics-status")?.textContent).toContain("Failed");
|
||||
});
|
||||
});
|
||||
|
||||
describe("playlist status badges", () => {
|
||||
beforeEach(() => {
|
||||
document.body.innerHTML = `<ul id="playlist-sortable"></ul>`;
|
||||
});
|
||||
|
||||
it("renders badges for every media status", () => {
|
||||
const statusMap = new Map<string, string>([
|
||||
["/app/media/ready.mp4", "ready"],
|
||||
["/app/media/needs.mp4", "needs_normalization"],
|
||||
["/app/media/normalizing.mp4", "normalizing"],
|
||||
["/app/media/failed.mp4", "normalization_failed"],
|
||||
["/app/media/other.mp4", "weird"],
|
||||
]);
|
||||
|
||||
renderPlaylistSortable(
|
||||
"file '/app/media/ready.mp4'\nfile '/app/media/needs.mp4'\nfile '/app/media/normalizing.mp4'\nfile '/app/media/failed.mp4'\nfile '/app/media/other.mp4'\nfile '/app/media/nopath.mp4'\n",
|
||||
statusMap,
|
||||
);
|
||||
|
||||
const list = document.getElementById("playlist-sortable")!;
|
||||
expect(list.innerHTML).toContain("badge-ok");
|
||||
expect(list.innerHTML).toContain("badge-warn");
|
||||
expect(list.innerHTML).toContain("badge-info");
|
||||
expect(list.innerHTML).toContain("badge-danger");
|
||||
expect(list.innerHTML).toContain("badge-muted"); // default + unknown fall back to muted
|
||||
expect(list.children).toHaveLength(6);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user