feat(T07): Warenkorb & Mietanfrage frontend – cart store, drawer, pages, form, tests
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
describe("Warenkorb Page", () => {
|
||||
const pagePath = resolve(__dirname, "../../pages/warenkorb.vue");
|
||||
const content = readFileSync(pagePath, "utf-8");
|
||||
|
||||
it("should have page title Warenkorb", () => {
|
||||
expect(content).toContain("Warenkorb");
|
||||
expect(content).toContain('data-testid="warenkorb-title"');
|
||||
});
|
||||
|
||||
it("should use useCart composable", () => {
|
||||
expect(content).toContain("useCart");
|
||||
});
|
||||
|
||||
it("should have breadcrumb navigation", () => {
|
||||
expect(content).toContain("Breadcrumb");
|
||||
expect(content).toContain('to="/"');
|
||||
});
|
||||
|
||||
it("should have empty state with link to mietkatalog", () => {
|
||||
expect(content).toContain('data-testid="warenkorb-empty"');
|
||||
expect(content).toContain('to="/mietkatalog"');
|
||||
expect(content).toContain("Ihr Warenkorb ist leer");
|
||||
});
|
||||
|
||||
it("should have cart item list with data-testid", () => {
|
||||
expect(content).toContain('data-testid="warenkorb-item"');
|
||||
});
|
||||
|
||||
it("should have item name with link to detail page", () => {
|
||||
expect(content).toContain('data-testid="warenkorb-item-name"');
|
||||
expect(content).toContain("/mietkatalog/");
|
||||
});
|
||||
|
||||
it("should have quantity stepper with increment and decrement", () => {
|
||||
expect(content).toContain('data-testid="warenkorb-item-stepper"');
|
||||
expect(content).toContain('data-testid="warenkorb-item-decrement"');
|
||||
expect(content).toContain('data-testid="warenkorb-item-increment"');
|
||||
expect(content).toContain("decrementQuantity");
|
||||
expect(content).toContain("incrementQuantity");
|
||||
});
|
||||
|
||||
it("should display item quantity", () => {
|
||||
expect(content).toContain('data-testid="warenkorb-item-quantity"');
|
||||
expect(content).toContain("item.quantity");
|
||||
});
|
||||
|
||||
it("should have remove button", () => {
|
||||
expect(content).toContain('data-testid="warenkorb-item-remove"');
|
||||
expect(content).toContain("removeItem");
|
||||
});
|
||||
|
||||
it("should have clear cart button", () => {
|
||||
expect(content).toContain('data-testid="warenkorb-clear"');
|
||||
expect(content).toContain("clearCart");
|
||||
expect(content).toContain("Warenkorb leeren");
|
||||
});
|
||||
|
||||
it("should have checkout link to mietanfrage", () => {
|
||||
expect(content).toContain('data-testid="warenkorb-checkout"');
|
||||
expect(content).toContain('to="/mietanfrage"');
|
||||
expect(content).toContain("Zur Mietanfrage");
|
||||
});
|
||||
|
||||
it("should display total count", () => {
|
||||
expect(content).toContain("totalCount");
|
||||
});
|
||||
|
||||
it("should use TypeScript with lang=ts", () => {
|
||||
expect(content).toContain('<script setup lang="ts">');
|
||||
});
|
||||
|
||||
it("should use Tailwind classes, no inline styles", () => {
|
||||
expect(content).not.toContain('style="');
|
||||
});
|
||||
|
||||
it("should use useHead for page title", () => {
|
||||
expect(content).toContain("useHead");
|
||||
});
|
||||
|
||||
it("should have formatPrice function", () => {
|
||||
expect(content).toContain("formatPrice");
|
||||
expect(content).toContain("Intl.NumberFormat");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user