File: existing-linebreaks.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 (34 lines) | stat: -rw-r--r-- 871 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
var test = require('tape')
var fs = require('fs')

var columnify =  require('../')

var data = [{
  name: "glob@3.2.9",
  paths: [
    "node_modules/tap/node_modules/glob",
    "node_modules/tape/node_modules/glob"
  ].join('\n')
}, {
  name: "nopt@2.2.1",
  paths: [
    "node_modules/tap/node_modules/nopt"
  ]
}, {
  name: "runforcover@0.0.2",
  paths: "node_modules/tap/node_modules/runforcover"
}]

test('leaving existing linebreaks', function(t) {
  t.plan(1)
  var expected = fs.readFileSync(__dirname + '/existing-linebreaks-expected.txt', 'utf8')
  t.equal(columnify(data, {preserveNewLines: true}).trim(), expected.trim())
  t.end()
})

test('removing existing linebreaks', function(t) {
  t.plan(1)
  var expected = fs.readFileSync(__dirname + '/remove-existing-linebreaks-expected.txt', 'utf8')
  t.equal(columnify(data).trim(), expected.trim())
  t.end()
})