Files
govoplan-campaign/webui/tests/delivery-mode-ui-structure.test.mjs

27 lines
1.5 KiB
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
const here = dirname(fileURLToPath(import.meta.url));
const source = readFileSync(resolve(here, "../src/features/campaigns/ReviewSendPage.tsx"), "utf8");
const modeSource = readFileSync(resolve(here, "../src/features/campaigns/utils/deliveryMode.ts"), "utf8");
assert.match(source, /getCampaignDeliveryOptions/);
assert.match(source, /queue_for_workers\.dae9a3e4/);
assert.match(source, /queue_for_workers_commits_durable_jobs_and_retur\.d0dbe81a/);
assert.match(source, /loading_the_effective_delivery_policy_\.d6893011/);
assert.match(source, /deliveryControlProgressMessage/);
assert.match(source, /synchronousSendAllowed/);
assert.match(source, /commandInProgress[\s\S]*refreshQueueStatus/);
assert.match(source, /<ConfirmDialog[\s\S]*open=\{queueConfirmOpen\}/);
assert.match(source, /<ConfirmDialog[\s\S]*open=\{cancelDeliveryConfirmOpen\}/);
assert.match(source, /deliveryModeLabel\(persistedDeliveryMode\)/);
assert.match(source, /this_version_last_entered_value0_mode_at_value1_\.c087d2f3/);
assert.match(source, /this_version_last_entered_value0_mode_this_recor\.ea2f201f/);
assert.doesNotMatch(source, /This version last entered/);
assert.match(modeSource, /synchronous\.77c61919/);
assert.match(modeSource, /worker_queue\.c911e32c/);
assert.match(modeSource, /database_queue\.8bf98437/);
assert.doesNotMatch(source, /window\.alert\s*\(/);