2026-07-10 01:32:19 +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("Warenkorb Page (prototype port)", () => {
|
2026-07-10 01:32:19 +02:00
|
|
|
const pagePath = resolve(__dirname, "../../pages/warenkorb.vue");
|
|
|
|
|
const content = readFileSync(pagePath, "utf-8");
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have page title Mietanfrage", () => {
|
|
|
|
|
expect(content).toContain("Mietanfrage");
|
2026-07-10 01:32:19 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should use useCart composable", () => {
|
|
|
|
|
expect(content).toContain("useCart");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should have empty state with link to mietkatalog", () => {
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("EmptyState");
|
|
|
|
|
expect(content).toContain("Warenkorb ist leer");
|
|
|
|
|
expect(content).toContain("/mietkatalog");
|
2026-07-10 01:32:19 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have cart item list", () => {
|
|
|
|
|
expect(content).toContain("cartItems");
|
|
|
|
|
expect(content).toContain("v-for");
|
2026-07-10 01:32:19 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should have quantity stepper with increment and decrement", () => {
|
|
|
|
|
expect(content).toContain("incrementQuantity");
|
2026-07-10 22:28:26 +02:00
|
|
|
expect(content).toContain("decrementQuantity");
|
2026-07-10 01:32:19 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should display item quantity", () => {
|
|
|
|
|
expect(content).toContain("item.quantity");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should have remove button", () => {
|
|
|
|
|
expect(content).toContain("removeItem");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should have clear cart button", () => {
|
|
|
|
|
expect(content).toContain("clearCart");
|
|
|
|
|
expect(content).toContain("Warenkorb leeren");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should display total count", () => {
|
|
|
|
|
expect(content).toContain("totalCount");
|
|
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have request form with name field", () => {
|
|
|
|
|
expect(content).toContain('id="req-name"');
|
|
|
|
|
expect(content).toContain("Name");
|
2026-07-10 01:32:19 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have request form with email field", () => {
|
|
|
|
|
expect(content).toContain('id="req-email"');
|
|
|
|
|
expect(content).toContain("E-Mail");
|
2026-07-10 01:32:19 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have request form with event date field", () => {
|
|
|
|
|
expect(content).toContain('id="req-date"');
|
|
|
|
|
expect(content).toContain("Veranstaltungsdatum");
|
2026-07-10 01:32:19 +02:00
|
|
|
});
|
|
|
|
|
|
2026-07-10 22:28:26 +02:00
|
|
|
it("should have request form with location field", () => {
|
|
|
|
|
expect(content).toContain('id="req-location"');
|
|
|
|
|
expect(content).toContain("Veranstaltungsort");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should have submit button", () => {
|
|
|
|
|
expect(content).toContain("Anfrage absenden");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should have success state", () => {
|
|
|
|
|
expect(content).toContain("Mietanfrage übermittelt");
|
|
|
|
|
expect(content).toContain("Vielen Dank");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should have hms-card for items", () => {
|
|
|
|
|
expect(content).toContain("hms-card");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should use TypeScript with lang=ts", () => {
|
|
|
|
|
expect(content).toContain('<script setup lang="ts">');
|
2026-07-10 01:32:19 +02:00
|
|
|
});
|
|
|
|
|
});
|