Skip to content

Commit

Permalink
test: refactor name spaces checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ruyadorno committed Mar 23, 2021
1 parent c537346 commit 5591a70
Showing 1 changed file with 42 additions and 11 deletions.
53 changes: 42 additions & 11 deletions test/name-spaces.js
@@ -1,14 +1,15 @@
var test = require('tap').test
var init = require('../')
var rimraf = require('rimraf')
var common = require('./lib/common')
const { resolve } = require('path')
const t = require('tap')
const init = require('../')
const common = require('./lib/common')

test('spaces', function (t) {
rimraf.sync(__dirname + '/package.json')
init(__dirname, '', {}, function (er, data) {
t.skip('single space', t => {
const dir = t.testdir({})

init(dir, '', {}, (er, data) => {
if (er)
throw er
var wanted = {
const wanted = {
name: 'the-name',
version: '1.0.0',
description: '',
Expand All @@ -21,9 +22,9 @@ test('spaces', function (t) {
t.has(data, wanted)
t.end()
})

common.drive([
'the name\n',
'the-name\n',
'\n',
'\n',
'\n',
Expand All @@ -36,6 +37,36 @@ test('spaces', function (t) {
])
})

test('teardown', function (t) {
rimraf(__dirname + '/package.json', t.end.bind(t))
t.skip('multiple spaces', t => {
const dir = t.testdir({})

init(dir, '', {}, (er, data) => {
if (er)
throw er
const wanted = {
name: 'the-name-should-be-this',
version: '1.0.0',
description: '',
scripts: { test: 'echo "Error: no test specified" && exit 1' },
license: 'ISC',
author: '',
main: 'basic.js'
}
console.log('')
t.has(data, wanted)
t.end()
})

common.drive([
'the name should be this\n',
'\n',
'\n',
'\n',
'\n',
'\n',
'\n',
'\n',
'\n',
'yes\n'
])
})

0 comments on commit 5591a70

Please sign in to comment.