diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2020-05-28 05:30:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-28 08:30:32 -0400 |
commit | 3cbcdd4250cda17cbafa8efdfc296b79d0f6d5c0 (patch) | |
tree | bb8cf1be2a3a57aff8ddfd6c1e70ab5f53bd3227 /cli/tests/unit/console_test.ts | |
parent | f6e58b076ca430c29f164b65678bbf6bc64a39b7 (diff) |
console: Hide `values` for console.table if display not necessary (#5914)
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r-- | cli/tests/unit/console_test.ts | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 35985dc1c..98e43c739 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -571,7 +571,7 @@ unitTest(function consoleTestStringifyIterable() { `[ <4 empty items>, 0, 0, <4 empty items> ]` ); - /* TODO(ry) Fix this test + /* TODO(ry) Fix this test const lWithEmptyEl = Array(200); lWithEmptyEl.fill(0, 50, 80); assertEquals( @@ -1073,6 +1073,36 @@ unitTest(function consoleTable(): void { ` ); }); + mockConsole((console, out): void => { + console.table([ + [1, 2], + [3, 4], + ]); + assertEquals( + stripColor(out.toString()), + `┌───────┬───┬───┐ +│ (idx) │ 0 │ 1 │ +├───────┼───┼───┤ +│ 0 │ 1 │ 2 │ +│ 1 │ 3 │ 4 │ +└───────┴───┴───┘ +` + ); + }); + mockConsole((console, out): void => { + console.table({ 1: { a: 4, b: 5 }, 2: null, 3: { b: 6, c: 7 } }, ["b"]); + assertEquals( + stripColor(out.toString()), + `┌───────┬───┐ +│ (idx) │ b │ +├───────┼───┤ +│ 1 │ 5 │ +│ 2 │ │ +│ 3 │ 6 │ +└───────┴───┘ +` + ); + }); }); // console.log(Error) test |