MCPcopy Create free account
hub / github.com/dolthub/doltgresql / assertQueryResult

Function assertQueryResult

testing/postgres-client-tests/node/helpers.js:41–64  ·  view source on GitHub ↗
(q, expected, data, matcher)

Source from the content-addressed store, hash-verified

39}
40
41export function assertQueryResult(q, expected, data, matcher) {
42 if (matcher) {
43 return matcher(data, expected);
44 }
45 if (q.toLowerCase().includes("dolt_commit")) {
46 if (data.rows.length !== 1) return false;
47 const hash = data.rows[0].dolt_commit[0];
48 if (hash.length !== 32) {
49 console.log("Invalid hash for dolt_commit:", hash);
50 return false;
51 }
52 expected.rows[0].dolt_commit = data.rows[0].dolt_commit;
53 }
54
55 // Does partial matching of actual and expected results.
56 const partialRes = {
57 command: data.command,
58 rowCount: data.rowCount,
59 oid: data.oid,
60 rows: data.rows,
61 fields: data.fields,
62 };
63 return JSON.stringify(expected) === JSON.stringify(partialRes);
64}

Callers 1

assertEqualRowsFunction · 0.85

Calls 1

matcherFunction · 0.85

Tested by

no test coverage detected