MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / createTableSelection

Function createTableSelection

test/nodeGraph/lookup.node.test.ts:34–58  ·  view source on GitHub ↗
(tableName: string, columns: string[], rows: Array<Array<string | number>>)

Source from the content-addressed store, hash-verified

32});
33
34const createTableSelection = (tableName: string, columns: string[], rows: Array<Array<string | number>>) => {
35 const schemaFields = rows.flatMap((row) => row.map((value, index) => createSchemaField(columns[index], value)));
36
37 return {
38 type: "TableSelection",
39 tables: [
40 {
41 name: `db\\${tableName}`,
42 fileName: tableName,
43 sourceFile: { name: `${tableName}.pack`, path: `${tableName}.pack`, loaded: true },
44 table: {
45 name: `db\\${tableName}`,
46 version: 1,
47 schemaFields,
48 tableSchema: {
49 version: 1,
50 fields: columns.map((columnName) => createDbField(columnName)),
51 },
52 },
53 },
54 ],
55 sourceFiles: [],
56 tableCount: 1,
57 };
58};
59
60describe("lookup node", () => {
61 it("cross joins table selections without requiring index columns", async () => {

Callers 1

Calls 2

createDbFieldFunction · 0.85
createSchemaFieldFunction · 0.70

Tested by

no test coverage detected