Files
Multi-Debrid-Downloader/tests/account-service-icons.test.ts
Sucukdeluxe 9f0140dd3c feat: refine account management and targeted editing
Add local provider icons, larger compact account rows, the requested column order, and full username display while keeping secrets masked. Replace provider-wide editing with a row-specific editor that preserves sibling accounts, exact limits, live usage counters, and status metadata. Add targeted credential validation, release notices, and regression coverage.
2026-08-09 21:32:09 +02:00

35 lines
1.2 KiB
TypeScript

import { readFile } from "node:fs/promises";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { ACCOUNT_SERVICE_ICONS } from "../src/renderer/account-service-icons";
const services = [
"realdebrid",
"megadebrid-api",
"megadebrid-web",
"bestdebrid",
"alldebrid",
"ddownload",
"onefichier",
"debridlink",
"linksnappy"
] as const;
describe("account service icons", () => {
it("bundles a valid local PNG or ICO for every account service", async () => {
expect(Object.keys(ACCOUNT_SERVICE_ICONS).sort()).toEqual([...services].sort());
for (const service of services) {
const relativePath = ACCOUNT_SERVICE_ICONS[service];
expect(relativePath.startsWith("./provider-icons/")).toBe(true);
const bytes = await readFile(path.resolve("assets", relativePath.slice(2)));
const png = bytes.subarray(0, 8).equals(Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]));
const ico = bytes.subarray(0, 4).equals(Buffer.from([0x00, 0x00, 0x01, 0x00]));
expect(png || ico).toBe(true);
}
});
it("uses the same Mega-Debrid icon for API and Web accounts", () => {
expect(ACCOUNT_SERVICE_ICONS["megadebrid-api"]).toBe(ACCOUNT_SERVICE_ICONS["megadebrid-web"]);
});
});