All files / apps/wp-editor/app/utils runLabel.ts

0% Statements 0/3
0% Branches 0/2
0% Functions 0/1
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15                             
import type { RunReport } from "#shared/types/RunReport.ts";
 
/** How each kind of bulk run names itself, what it did to an article, and what a rerun retries. */
export const RUN_LABELS = {
    apply: { name: "Bulk apply", ok: "Applied", doing: "Writing", retried: "pending" },
    "dry-run": { name: "Dry run", ok: "Would apply", doing: "Checking", retried: "pending" },
    restore: { name: "Bulk restore", ok: "Restored", doing: "Restoring", retried: "applied" },
} as const satisfies Record<
    RunReport["kind"],
    { name: string; ok: string; doing: string; retried: string }
>;
 
export const runLabel = ({ kind, incomplete }: Pick<RunReport, "kind" | "incomplete">): string =>
    `${RUN_LABELS[kind].name}${incomplete ? " (incomplete)" : ""}`;