File: align-center.js

package info (click to toggle)
node-columnify 1.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 29,684 kB
  • sloc: makefile: 9
file content (24 lines) | stat: -rw-r--r-- 774 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var test = require('tape')
var fs = require('fs')

var columnify =  require('../')

var data = {
  "mocha@1.18.2": 1,
  "commander@2.0.0": 1,
  "debug@0.8.1": 1
}

test('columns can be aligned to the center', function(t) {
  t.plan(1)
  var expected = fs.readFileSync(__dirname + '/align-center-expected.txt', 'utf8')
  var actual = columnify(data, { paddingChr: '.', config: {value: {align: 'center'}}})
  t.equal(actual.trim(), expected.trim())
})

test('columns can be aligned to the centre using the correct spelling of centre', function(t) {
  t.plan(1)
  var expected = fs.readFileSync(__dirname + '/align-center-expected.txt', 'utf8')
  var actual = columnify(data, { paddingChr: '.', config: {value: {align: 'centre'}}})
  t.equal(actual.trim(), expected.trim())
})