Files
ReadaBook/apps/web/src/reader/useAdaptiveReading.test.ts

22 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe, expect, it } from "vitest";
import { adaptiveStatusLabel } from "./useAdaptiveReading";
describe("adaptive reading status", () => {
it("uses the short reader wording without a global percentage", () => {
expect(adaptiveStatusLabel("opening", false)).toBe("Ouverture de la page…");
expect(adaptiveStatusLabel("next", false)).toBe("Préparation de la page suivante…");
expect(adaptiveStatusLabel("neighbors", false)).toBe("Chargement des pages voisines…");
expect(adaptiveStatusLabel("slow", false)).toBe("Connexion lente. On charge d’abord cette page.");
expect(adaptiveStatusLabel("offline", false)).toBe("Hors connexion. La page déjà chargée reste disponible.");
for (const status of ["opening", "next", "neighbors", "slow", "offline", "idle"] as const) {
const label = adaptiveStatusLabel(status, false) ?? "";
expect(label).not.toMatch(/%|pourcentage|global|manifest|spine|range|etag|cache|resource|locator/i);
}
});
it("announces a lightweight resource when the manifest supports it", () => {
expect(adaptiveStatusLabel("opening", true)).toBe("Version allégée");
});
});