67 lines
2.6 KiB
TypeScript
67 lines
2.6 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import test from "node:test";
|
|
|
|
const campaignsBoardPath = join(
|
|
process.cwd(),
|
|
"components",
|
|
"campaigns",
|
|
"campaigns-board.tsx",
|
|
);
|
|
const globalsPath = join(process.cwd(), "app", "globals.css");
|
|
|
|
test("campaign board renders campaigns as a desktop ledger with mobile records", async () => {
|
|
const source = await readFile(campaignsBoardPath, "utf8");
|
|
|
|
assert.doesNotMatch(source, /<table\b/i);
|
|
assert.doesNotMatch(source, /<thead\b/i);
|
|
assert.doesNotMatch(source, /<tbody\b/i);
|
|
assert.doesNotMatch(source, /<tr\b/i);
|
|
assert.doesNotMatch(source, /<td\b/i);
|
|
assert.doesNotMatch(source, /<th\b/i);
|
|
|
|
assert.doesNotMatch(source, /className="grid gap-3 sm:grid-cols-2 xl:grid-cols-3"/);
|
|
assert.match(source, /2xl:grid-cols-\[minmax\(0,1fr\)_21rem\]/);
|
|
assert.match(source, /campaign-ledger hidden 2xl:block/);
|
|
assert.match(source, /campaign-mobile-records grid gap-3 2xl:hidden/);
|
|
assert.match(source, /role="table"/);
|
|
assert.match(source, /role="rowgroup"/);
|
|
assert.match(source, /role="row"/);
|
|
assert.match(source, /role="cell"/);
|
|
|
|
assert.match(source, /<Switch/);
|
|
assert.match(source, /id=\{campaignTitleId\}/);
|
|
assert.match(source, /openEditDialog\(campaign\)/);
|
|
assert.match(source, /toggleCampaign\(campaign\)/);
|
|
assert.match(source, /runCampaign\(campaign\)/);
|
|
assert.match(source, /Suchlauf starten/);
|
|
assert.match(source, /Lead-Limit/);
|
|
assert.match(source, /Audit-Limit/);
|
|
assert.match(source, /Letzter Lauf/);
|
|
assert.match(source, /Nächster Lauf/);
|
|
assert.doesNotMatch(source, /Limits:\s*L/);
|
|
});
|
|
|
|
test("campaign board surfaces recent run logs", async () => {
|
|
const source = await readFile(campaignsBoardPath, "utf8");
|
|
|
|
assert.match(source, /api\.runs\.list/);
|
|
assert.match(source, /type:\s*"campaign"/);
|
|
assert.match(source, /Aktuelle Run-Logs/);
|
|
assert.match(source, /campaign-status-rail/);
|
|
assert.match(source, /Versand nur nach Freigabe/);
|
|
assert.match(source, /getRunStatusClassName/);
|
|
assert.match(source, /getRunStepClassName/);
|
|
assert.match(source, /run\.errorSummary/);
|
|
assert.match(source, /campaign_cron_skipped/);
|
|
});
|
|
|
|
test("campaign ledger avoids clipping actions at desktop breakpoints", async () => {
|
|
const styles = await readFile(globalsPath, "utf8");
|
|
|
|
assert.match(styles, /\.campaign-ledger\s*{[\s\S]*overflow-x:\s*auto;/);
|
|
assert.doesNotMatch(styles, /\.campaign-ledger\s*{[\s\S]*overflow:\s*hidden;/);
|
|
assert.match(styles, /\.campaign-ledger-row\s*{[\s\S]*min-width:\s*58rem;/);
|
|
});
|