Skip to content

Commit

Permalink
chore(test): update esm test to verify correct behavior
Browse files Browse the repository at this point in the history
Previously, it was verifying *incorrect* behavior.
  • Loading branch information
isaacs committed May 1, 2023
1 parent fafee28 commit f236663
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
"test": "c8 mocha ./test/*.cjs",
"test:esm": "c8 mocha ./test/esm/cliui-test.mjs",
"test:esm": "c8 mocha ./test/**/*.mjs",
"postest": "check",
"coverage": "c8 report --check-coverage",
"precompile": "rimraf build",
Expand Down
11 changes: 5 additions & 6 deletions test/deno/cliui-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ Deno.test('evenly divides text across columns if multiple columns are given', ()
})

// it should wrap each column appropriately.
// TODO: we should flesh out the Deno and ESM implementation
// such that it spreads words out over multiple columns appropriately:
const expected = [
'i am a string ti am a seconi am a third',
'hat should be wd string tha string that',
'rapped t should be should be w',
' wrapped rapped'
'i am a string i am a i am a third',
'that should be second string that',
'wrapped string that should be',
' should be wrapped',
' wrapped',
]

ui.toString().split('\n').forEach((line: string, i: number) => {
Expand Down
11 changes: 6 additions & 5 deletions test/esm/cliui-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ describe('ESM', () => {
// TODO: we should flesh out the Deno and ESM implementation
// such that it spreads words out over multiple columns appropriately:
const expected = [
'i am a string ti am a seconi am a third',
'hat should be wd string tha string that',
'rapped t should be should be w',
' wrapped rapped'
'i am a string i am a i am a third',
'that should be second string that',
'wrapped string that should be',
' should be wrapped',
' wrapped',
]
ui.toString().split('\n').forEach((line, i) => {
strictEqual(line, expected[i])
})
})
})
})

0 comments on commit f236663

Please sign in to comment.