1
0
Fork 0
fahrPool/web/lib/auftraege/klonen.test.ts

15 lines
633 B
TypeScript

import { describe, expect, it } from "vitest";
import { folgeauftragUrl } from "./klonen";
describe("folgeauftragUrl", () => {
it("setzt alten Zielort als Abholort, Fahrzeug und Vorgaenger", () => {
const url = folgeauftragUrl({ id: "a1", zielort: { id: "o2" }, fahrzeug: { id: "f1" } });
expect(url.startsWith("/auftraege/neu?")).toBe(true);
const params = new URLSearchParams(url.split("?")[1]);
expect(params.get("abholort_id")).toBe("o2");
expect(params.get("fahrzeug_id")).toBe("f1");
expect(params.get("vorgaenger_auftrag_id")).toBe("a1");
expect(params.has("zielort_id")).toBe(false);
});
});