Files
Multi-Debrid-Downloader/tests/provider-error-classification.test.ts
T
Sucukdeluxe 1b7caba2eb feat: add Deepbrid, daily scheduling, and notification center
Add encrypted Deepbrid API accounts with account validation, provider routing, fallback, usage tracking, safe error handling, and verified 1Fichier downloads. Restore persistent recurring daily starts with local-calendar deduplication and legacy schedule compatibility. Add durable Discord package, run, remaining-volume, stall, and recovery notifications with privacy-safe telemetry and disk-failure recovery.
2026-08-24 07:37:55 +02:00

28 lines
1.5 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { classifyProviderUnrestrictBackoff, isProviderUnrestrictFailure, parseDebridLinkTerminalFailure } from "../src/main/download-manager";
describe("provider error classification", () => {
it("does not relabel an aggregated Real-Debrid failure as Debrid-Link", () => {
const message = "Error: Unrestrict fehlgeschlagen: Mega-Debrid nicht verfuegbar (alle aktiven Accounts deaktiviert oder ausgeschopft) | Debrid-Link nicht verfuegbar (alle aktiven API-Keys deaktiviert oder ausgeschopft) | Real-Debrid: traffic_exhausted";
expect(parseDebridLinkTerminalFailure(message)).toBeNull();
});
it("still recognizes a direct Debrid-Link terminal failure", () => {
expect(parseDebridLinkTerminalFailure("Debrid-Link nicht verfuegbar: kein aktiver API-Key")).toMatchObject({
kind: "no_active_key"
});
});
it.each([
["Deepbrid-Anfrage fehlgeschlagen (rate_limit, HTTP 429, Code 429)", "busy"],
["Deepbrid-Anfrage fehlgeschlagen (temporary, HTTP 503, Code 503)", "temporary"],
["Deepbrid-Anfrage fehlgeschlagen (auth, HTTP 401, Code 401)", null],
["Deepbrid-Anfrage fehlgeschlagen (link, HTTP 400, Code 17)", null],
["Deepbrid-Anfrage fehlgeschlagen (malformed, HTTP 200, Code 200)", null]
])("classifies Deepbrid backoff precisely for %s", (message, expected) => {
expect(classifyProviderUnrestrictBackoff(message)).toBe(expected);
expect(isProviderUnrestrictFailure(message)).toBe(true);
});
});