summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/init-package-json/test/name-spaces.js
blob: dee974fc8aa82fbfecc1c8b098d92a68ca9673b4 (plain)
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
37
38
var test = require('tap').test
var init = require('../')
var rimraf = require('rimraf')
var common = require('./lib/common')

test('spaces', function (t) {
  init(__dirname, '', {}, function (er, data) {
    t.ok(!er, 'should not error')
    var wanted = {
      name: 'the-name',
      version: '1.0.0',
      description: '',
      scripts: { test: 'echo "Error: no test specified" && exit 1' },
      license: 'ISC',
      author: '',
      main: 'basic.js'
    }
    t.same(data, wanted)
    t.end()
  })
  common.drive([
    'the name\n',
    'the-name\n',
    '\n',
    '\n',
    '\n',
    '\n',
    '\n',
    '\n',
    '\n',
    '\n',
    'yes\n'
  ])
})

test('teardown', function (t) {
  rimraf(__dirname + '/package.json', t.end.bind(t))
})