MCPcopy
hub / github.com/jestjs/jest / template

Function template

packages/jest-each/src/table/template.ts:17–28  ·  view source on GitHub ↗
(
  title: string,
  headings: Headings,
  row: Global.Row,
)

Source from the content-addressed store, hash-verified

15} from './interpolation';
16
17export default function template(
18 title: string,
19 headings: Headings,
20 row: Global.Row,
21): EachTests {
22 const table = convertRowToTable(row, headings);
23 const templates = convertTableToTemplates(table, headings);
24 return templates.map((template, index) => ({
25 arguments: [template],
26 title: interpolateVariables(title, template, index),
27 }));
28}
29
30const convertRowToTable = (row: Global.Row, headings: Headings): Global.Table =>
31 Array.from({length: row.length / headings.length}, (_, index) =>

Calls 3

interpolateVariablesFunction · 0.90
convertRowToTableFunction · 0.85
convertTableToTemplatesFunction · 0.85

Tested by

no test coverage detected