Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tbantle22 committed Jul 11, 2023
1 parent 1faab30 commit a7d0675
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
7 changes: 7 additions & 0 deletions integration-tests/mysql-client-tests/node/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
20 changes: 8 additions & 12 deletions integration-tests/mysql-client-tests/node/workbenchTests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
})
Expand All @@ -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);
}

0 comments on commit a7d0675

Please sign in to comment.