Skip to content

Commit

Permalink
Simpler suffix for test-each
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 20, 2019
1 parent a818523 commit e7f0ec2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion test/echo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ testEach(
METHODS,
[{ opts: { echo: false } }, { opts: { echo: true } }],
(title, methodProps, data) =>
test(`'echo' option ${title}`, t => snapshotTest({ t, methodProps, data })),
test(`'echo' option | ${title}`, t =>
snapshotTest({ t, methodProps, data })),
)
2 changes: 1 addition & 1 deletion test/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { snapshotTest } from './helpers/snapshot.js'
import { EXEC_METHODS } from './helpers/methods.js'

testEach(EXEC_METHODS, [{}], (title, methodProps, data) =>
test(`exec() ${title}`, t => snapshotTest({ t, methodProps, data })),
test(`exec() | ${title}`, t => snapshotTest({ t, methodProps, data })),
)
3 changes: 1 addition & 2 deletions test/helpers/test_each/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export const getTitles = function(args) {
}

const getTitle = function(args) {
const title = args.map(getName).join(' ')
return `| ${title}`
return args.map(getName).join(' ')
}

const getName = function(arg) {
Expand Down
4 changes: 2 additions & 2 deletions test/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ testEach(
METHODS,
[{ command: true }, { command: ' ' }],
(title, methodProps, data) =>
test(`Invalid command ${title}`, t =>
test(`Invalid command | ${title}`, t =>
snapshotTest({ t, methodProps, data })),
)

testEach(
METHODS,
[{ opts: { uid: 0.5 } }, { command: 'invalid', read: false }],
(title, methodProps, data) =>
test(`Errored command ${title}`, t =>
test(`Errored command | ${title}`, t =>
snapshotTest({ t, methodProps, data })),
)
4 changes: 2 additions & 2 deletions test/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ testEach(
{ opts: { from: 'invalid' } },
],
(title, methodProps, data) =>
test(`Invalid options ${title}`, t =>
test(`Invalid options | ${title}`, t =>
snapshotTest({ t, methodProps, data })),
)

testEach(METHODS, [{}, { opts: {} }], (title, methodProps, data) =>
test(`No options ${title}`, t => snapshotTest({ t, methodProps, data })),
test(`No options | ${title}`, t => snapshotTest({ t, methodProps, data })),
)
2 changes: 1 addition & 1 deletion test/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ testEach(
{ opts: { stripFinalNewline: true } },
],
(title, methodProps, data) =>
test(`stream() ${title}`, t => snapshotTest({ t, methodProps, data })),
test(`stream() | ${title}`, t => snapshotTest({ t, methodProps, data })),
)
2 changes: 1 addition & 1 deletion test/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { snapshotTest } from './helpers/snapshot.js'
import { TASK_METHODS } from './helpers/methods.js'

testEach(TASK_METHODS, [{}, { task: 'nested' }], (title, methodProps, data) =>
test(`task() ${title}`, t => snapshotTest({ t, methodProps, data })),
test(`task() | ${title}`, t => snapshotTest({ t, methodProps, data })),
)
2 changes: 1 addition & 1 deletion test/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ testEach(
{ opts: { verbose: true, stdio: 'pipe', stdout: 'pipe', stderr: 'pipe' } },
],
(title, methodProps, data) =>
test(`'verbose' option ${title}`, t =>
test(`'verbose' option | ${title}`, t =>
snapshotTest({ t, methodProps, data })),
)

0 comments on commit e7f0ec2

Please sign in to comment.