41 lines
1.3 KiB
TypeScript
41 lines
1.3 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",
|
|
);
|
|
|
|
test("campaign board renders campaigns as responsive cards", 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, /md:hidden/i);
|
|
assert.doesNotMatch(source, /md:block/i);
|
|
|
|
assert.match(source, /className="grid gap-3"/);
|
|
assert.match(source, /openEditDialog\(campaign\)/);
|
|
assert.match(source, /toggleCampaign\(campaign\)/);
|
|
assert.match(source, /runCampaign\(campaign\)/);
|
|
});
|
|
|
|
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, /run\.errorSummary/);
|
|
assert.match(source, /campaign_cron_skipped/);
|
|
});
|