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("Mietkatalog Page (prototype port)", () => {
|
2026-07-10 00:54:40 +02:00
|
|
|
const pagePath = resolve(__dirname, "../../pages/mietkatalog.vue");
|
|
|
|
|
const content = readFileSync(pagePath, "utf-8");
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have page title Mietkatalog", () => {
|
|
|
|
|
expect(content).toContain("Mietkatalog");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have search input with hms-input", () => {
|
|
|
|
|
expect(content).toContain('type="search"');
|
|
|
|
|
expect(content).toContain("hms-input");
|
|
|
|
|
expect(content).toContain("searchQuery");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have sort dropdown", () => {
|
|
|
|
|
expect(content).toContain("sortBy");
|
|
|
|
|
expect(content).toContain("name");
|
|
|
|
|
expect(content).toContain("brand");
|
|
|
|
|
expect(content).toContain("code");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have category filter chips with hms-chip", () => {
|
|
|
|
|
expect(content).toContain("hms-chip");
|
|
|
|
|
expect(content).toContain("activeCategory");
|
|
|
|
|
expect(content).toContain("Tontechnik");
|
|
|
|
|
expect(content).toContain("Lichttechnik");
|
|
|
|
|
expect(content).toContain("Rigging");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should show result count", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("filteredEquipment.length");
|
|
|
|
|
expect(content).toContain("Gerät");
|
|
|
|
|
expect(content).toContain("gefunden");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should use LoadingSkeleton component", () => {
|
|
|
|
|
expect(content).toContain("LoadingSkeleton");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should use ErrorState component", () => {
|
|
|
|
|
expect(content).toContain("ErrorState");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should use EmptyState component", () => {
|
2026-07-10 00:54:40 +02:00
|
|
|
expect(content).toContain("EmptyState");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should render EquipmentCard for each item", () => {
|
|
|
|
|
expect(content).toContain("EquipmentCard");
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("filteredEquipment");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have 18 equipment items", () => {
|
|
|
|
|
expect(content).toContain("L-Acoustics K2");
|
|
|
|
|
expect(content).toContain("Shure SM58");
|
|
|
|
|
expect(content).toContain("Sennheiser EW-DX 835");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have Warenkorb button", () => {
|
|
|
|
|
expect(content).toContain("Warenkorb ansehen");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should use TypeScript with lang=ts", () => {
|
|
|
|
|
expect(content).toContain('<script setup lang="ts">');
|
|
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should use hms-card for filter panel", () => {
|
|
|
|
|
expect(content).toContain("hms-card");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
describe("EquipmentCard Component (prototype port)", () => {
|
2026-07-10 00:54:40 +02:00
|
|
|
const cardPath = resolve(__dirname, "../../components/EquipmentCard.vue");
|
|
|
|
|
const content = readFileSync(cardPath, "utf-8");
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have hms-eq-card class", () => {
|
|
|
|
|
expect(content).toContain("hms-eq-card");
|
|
|
|
|
});
|
|
|
|
|
|
2026-07-10 00:54:40 +02:00
|
|
|
it("should have image with fallback placeholder", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("item.image");
|
|
|
|
|
expect(content).toContain("📦");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should show category badge", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("hms-badge");
|
|
|
|
|
expect(content).toContain("hms-badge-primary");
|
|
|
|
|
expect(content).toContain("item.category");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should display equipment name", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("item.name");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should show truncated description", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("item.description");
|
2026-07-10 00:54:40 +02:00
|
|
|
expect(content).toContain("line-clamp");
|
|
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should display item code", () => {
|
|
|
|
|
expect(content).toContain("item.code");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should emit add-to-cart", () => {
|
2026-07-10 00:54:40 +02:00
|
|
|
expect(content).toContain("add-to-cart");
|
|
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have Hinzufügen button", () => {
|
|
|
|
|
expect(content).toContain("Hinzufügen");
|
|
|
|
|
expect(content).toContain("hms-btn-ghost");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should emit click", () => {
|
|
|
|
|
expect(content).toContain("click");
|
2026-07-10 00:54:40 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should use TypeScript with lang=ts", () => {
|
2026-07-10 00:54:40 +02:00
|
|
|
expect(content).toContain('<script setup lang="ts">');
|
|
|
|
|
});
|
|
|
|
|
});
|