File: wrap-with-padding.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 (36 lines) | stat: -rw-r--r-- 819 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
25
26
27
28
29
30
31
32
33
34
35
36
var test = require('tape')
var fs = require('fs')

var columnify =  require('../')

var data = [{
  name: 'mod1',
  description: 'some description which happens to be far larger than the max',
  version: '0.0.1',
}, {
  name: 'module-two',
  description: 'another description larger than the max',
  version: '0.2.0',
}, {
  name: 'mod3',
  description: 'thisisaverylongwordandshouldbewrapped',
  version: '0.3.0',
}, {
  name: 'module-four-four-four-four',
  description: '',
  version: '0.0.4',
}]

test('wrapping wide columns', function(t) {
  t.plan(1)
  var expected = fs.readFileSync(__dirname + '/wrap-with-padding-expected.txt', 'utf8')
  t.equal(columnify(data, {
    paddingChr: '.',
    config: {
      description: {
        maxWidth: 30,
        minWidth: 10
      }
    }
  }).trim(), expected.trim())
})