2026-07-10 00:54:40 +02:00
|
|
|
import { describe, it, expect } from "vitest";
|
|
|
|
|
import { readFileSync } from "node:fs";
|
|
|
|
|
import { resolve } from "node:path";
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
describe("Equipment Detail Page (prototype port)", () => {
|
2026-07-10 00:54:40 +02:00
|
|
|
const pagePath = resolve(__dirname, "../../pages/mietkatalog/[id].vue");
|
|
|
|
|
const content = readFileSync(pagePath, "utf-8");
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have breadcrumb navigation back to mietkatalog", () => {
|
|
|
|
|
expect(content).toContain("Zurück zum Katalog");
|
|
|
|
|
expect(content).toContain("/mietkatalog");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should display equipment name", () => {
|
|
|
|
|
expect(content).toContain("item.name");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should display item code", () => {
|
|
|
|
|
expect(content).toContain("item.code");
|
|
|
|
|
expect(content).toContain("Artikelnummer");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should display brand", () => {
|
|
|
|
|
expect(content).toContain("item.brand");
|
|
|
|
|
expect(content).toContain("Marke");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should display description", () => {
|
|
|
|
|
expect(content).toContain("item.description");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should display specs table", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("item.specs");
|
|
|
|
|
expect(content).toContain("Technische Daten");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should display image with placeholder fallback", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("item.image");
|
|
|
|
|
expect(content).toContain("📦");
|
|
|
|
|
expect(content).toContain("Kein Bild verfügbar");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have Mietanfrage section", () => {
|
2026-07-10 00:54:40 +02:00
|
|
|
expect(content).toContain("Mietanfrage");
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("Mietbeginn");
|
|
|
|
|
expect(content).toContain("Mietende");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have quantity selector", () => {
|
|
|
|
|
expect(content).toContain("quantity");
|
|
|
|
|
expect(content).toContain("Anzahl");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have add to cart button", () => {
|
|
|
|
|
expect(content).toContain("Zur Mietanfrage hinzufügen");
|
|
|
|
|
expect(content).toContain("hms-btn-primary");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should show ErrorState for non-existent ID", () => {
|
|
|
|
|
expect(content).toContain("ErrorState");
|
|
|
|
|
expect(content).toContain("nicht gefunden");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have related items section", () => {
|
|
|
|
|
expect(content).toContain("relatedItems");
|
|
|
|
|
expect(content).toContain("Ähnliche Geräte");
|
|
|
|
|
expect(content).toContain("EquipmentCard");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should use loading skeleton", () => {
|
|
|
|
|
expect(content).toContain("hms-skeleton");
|
|
|
|
|
expect(content).toContain("loading");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should use TypeScript with lang=ts", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain('<script setup lang="ts">');
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have 18 equipment items in data", () => {
|
|
|
|
|
expect(content).toContain("L-Acoustics K2");
|
|
|
|
|
expect(content).toContain("Sennheiser EW-DX 835");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
});
|