import { describe, expect, it } from "vitest";
import { safeDecodePathSegment } from "./path-utils";

describe("safeDecodePathSegment", () => {
  it("retourne une chaîne vide si absence de valeur", () => {
    expect(safeDecodePathSegment(undefined)).toBe("");
  });

  it("décode un segment d’URL correctement encodé", () => {
    expect(safeDecodePathSegment("caf%C3%A9")).toBe("café");
  });

  it("retourne la valeur brute si le décodage échoue", () => {
    expect(safeDecodePathSegment("%E0%A4%A")).toBe("%E0%A4%A");
  });
});
