Skip to content

Commit 8f386a0

Browse files
committed
Add test
1 parent 31ade79 commit 8f386a0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/utils/queryUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ export function convertRowsToConsole(rows: string[]): string[] {
379379
const prevCol = columnCounters[j - 1];
380380
if (prevCol) {
381381
row[j] += "\n" + " ".repeat(prevCol);
382+
} else {
383+
row[j] += "\n";
382384
}
383385
}
384386

test/suite/utils/queryUtils.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,19 @@ describe("queryUtils", () => {
284284

285285
assert.deepEqual(result, expectedRes);
286286
});
287+
288+
it("should work with rows with newlines", () => {
289+
const rows = ["a#$#;header;#$#b", "a1\na2#$#;#$#b1\nb2", "3#$#;#$#4"];
290+
const expectedRes = [
291+
"a b ",
292+
"--------",
293+
"a1 \na2 b1 \n b2 ",
294+
"3 4 ",
295+
];
296+
const result = queryUtils.convertRowsToConsole(rows);
297+
298+
assert.deepEqual(result, expectedRes);
299+
});
287300
});
288301

289302
it("getConnectionType", () => {

0 commit comments

Comments
 (0)