Skip to content

Commit

Permalink
let -> const
Browse files Browse the repository at this point in the history
  • Loading branch information
nexdrew committed Jul 12, 2019
1 parent 30af289 commit cfef01f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/ansi-align.js
Expand Up @@ -9,43 +9,43 @@ test('does not blow up on undefined args', (t) => {
test('aligns center, splits line feed, and pads with space by default', (t) => {
// one two three
// four five
let out = ansiAlign('one two three\nfour five')
const out = ansiAlign('one two three\nfour five')
t.is(out, 'one two three\n four five')
})

test('supports ansi', (t) => {
// first line has four ansi escape sequences
// second line has two ansi escape sequences
let inp = chalk.red('one') + ' two ' + chalk.bold('three') + '\n' + chalk.cyan('four ') + 'five'
let out = ansiAlign(inp)
const inp = chalk.red('one') + ' two ' + chalk.bold('three') + '\n' + chalk.cyan('four ') + 'five'
const out = ansiAlign(inp)
t.is(out, chalk.red('one') + ' two ' + chalk.bold('three') + '\n ' + chalk.cyan('four ') + 'five')
})

test('returns array if given array', (t) => {
// one two
// three four five
let inp = [chalk.green('one two'), 'three four five']
let out = ansiAlign(inp)
const inp = [chalk.green('one two'), 'three four five']
const out = ansiAlign(inp)
t.deepEqual(out, [' ' + chalk.green('one two'), 'three four five'])
})

test('accepts opts for split, pad, and align', (t) => {
// ........one two
// three four five
let inp = 'one two\tthree four five'
let out = ansiAlign(inp, { split: '\t', pad: '.', align: 'right' })
const inp = 'one two\tthree four five'
const out = ansiAlign(inp, { split: '\t', pad: '.', align: 'right' })
t.is(out, '........one two\tthree four five')
})

test('supports `align: \'left\'` as no-op', (t) => {
let inp = 'one two three\nfour five'
let out = ansiAlign(inp, { align: 'left' })
const inp = 'one two three\nfour five'
const out = ansiAlign(inp, { align: 'left' })
t.is(out, inp)
})

test('ansiAlign.left is alias for left align (no-op)', (t) => {
let inp = 'one two three\nfour five'
let out = ansiAlign.left(inp)
const inp = 'one two three\nfour five'
const out = ansiAlign.left(inp)
t.is(out, inp)
})

Expand All @@ -54,8 +54,8 @@ test('ansiAlign.center is alias for center align', (t) => {
// two
// three four
// five
let inp = [' one ', ' two ', ' three four ', ' five ']
let out = ansiAlign.center(inp)
const inp = [' one ', ' two ', ' three four ', ' five ']
const out = ansiAlign.center(inp)
t.deepEqual(out, [' one ', ' two ', ' three four ', ' five '])
})

Expand All @@ -64,7 +64,7 @@ test('ansiAlign.right is alias for right align', (t) => {
// two three
// four
// five
let inp = 'one\ntwo three\nfour\nfive'
let out = ansiAlign.right(inp)
const inp = 'one\ntwo three\nfour\nfive'
const out = ansiAlign.right(inp)
t.is(out, ' one\ntwo three\n four\n five')
})

0 comments on commit cfef01f

Please sign in to comment.