All files / core/blong-kukum/primitives shared.ts

100% Statements 24/24
100% Branches 3/3
100% Functions 3/3
100% Lines 24/24

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 16 17 18 19 20 21 22 23 24 251x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import {capitalize, type PrimitiveContext} from '../engine.ts';
 
/**
 * Small helpers shared by several descriptors.
 *
 * These are deliberately dependency-free: they are the leaf of the catalogue's
 * import graph, so every descriptor can reach them without pulling in another
 * descriptor.
 */
 
/** The layer a descriptor targets, defaulting to the caller's suggestion. */
export const layerOf = (ctx: PrimitiveContext, fallback: string): string => ctx.layer ?? fallback;
 
/** The handler group a descriptor targets, defaulting to the subject. */
export const groupOf = (ctx: PrimitiveContext): string => ctx.group ?? ctx.subject;
 
/**
 * The stable name of the first row a generated seed declares.
 *
 * Shared by the seed and the Playwright spec on purpose: the browse screenshot
 * filters on it, so the two drifting apart would silently produce a baseline
 * that captures whatever else happens to be in the table.
 */
export const seedRowName = (object: string): string => `Sample ${capitalize(object)} One`;