]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/init-package-json/test/scope-in-config-existing-name.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / init-package-json / test / scope-in-config-existing-name.js
1 var fs = require('fs')
2 var path = require('path')
3
4 var rimraf = require('rimraf')
5 var tap = require('tap')
6
7 var init = require('../')
8
9 var json = {
10   name: '@already/scoped',
11   version: '1.0.0'
12 }
13
14 tap.test('with existing package.json', function (t) {
15   fs.writeFileSync(path.join(__dirname, 'package.json'), JSON.stringify(json, null, 2))
16   console.log(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'))
17   console.error('wrote json', json)
18   init(__dirname, __dirname, { yes: 'yes', scope: '@still' }, function (er, data) {
19     if (er) throw er
20
21     console.log('')
22     t.equal(data.name, '@still/scoped', 'new scope is added, basic name is kept')
23     t.end()
24   })
25 })
26
27 tap.test('teardown', function (t) {
28   rimraf.sync(path.join(__dirname, 'package.json'))
29   t.end()
30 })