mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-25 18:28:57 -06:00
Fix tests
This commit is contained in:
@@ -26,6 +26,13 @@ export function assertQueryResult(q, resultStr, expected, rows, matcher) {
|
||||
if (q.toLowerCase().includes("dolt_commit")) {
|
||||
return rows.length === 1 && rows[0].hash.length === 32;
|
||||
}
|
||||
if (q.toLowerCase().includes("dolt_merge")) {
|
||||
const result = JSON.parse(resultStr);
|
||||
return (
|
||||
expected.fast_forward === result.fast_forward &&
|
||||
expected.conflicts === result.conflicts
|
||||
);
|
||||
}
|
||||
return resultStr === JSON.stringify(expected);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,14 @@ async function runTests(database, tests) {
|
||||
assertEqualRows(test, rows);
|
||||
})
|
||||
.catch((err) => {
|
||||
handleError(test, err);
|
||||
if (test.expectedErr) {
|
||||
if (err.message.includes(test.expectedErr)) {
|
||||
return;
|
||||
} else {
|
||||
console.log("Query error did not match expected:", test.q);
|
||||
}
|
||||
}
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
})
|
||||
@@ -64,14 +71,3 @@ function assertEqualRows(test, rows) {
|
||||
throw new Error(`Query failed: ${test.q}`);
|
||||
}
|
||||
}
|
||||
|
||||
function handleError(test, err) {
|
||||
if (test.expectedErr) {
|
||||
if (err.message.includes(test.expectedErr)) {
|
||||
return;
|
||||
} else {
|
||||
console.log("Query error did not match expected:", test.q);
|
||||
}
|
||||
}
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user