1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-01 02:27:20 -04:00
notes/node_modules/normalize-package-data/test/mixedcase-names.js

33 lines
768 B
JavaScript
Raw Normal View History

2017-03-09 13:16:08 -05:00
var test = require('tap').test
var normalize = require('../')
var fixer = normalize.fixer
test('mixedcase', function (t) {
t.doesNotThrow(function () {
fixer.fixNameField({name: 'foo'}, true)
})
t.doesNotThrow(function () {
fixer.fixNameField({name: 'foo'}, false)
})
t.doesNotThrow(function () {
fixer.fixNameField({name: 'foo'})
})
t.throws(function () {
fixer.fixNameField({name: 'Foo'}, true)
}, new Error('Invalid name: "Foo"'), 'should throw an error')
t.throws(function () {
fixer.fixNameField({name: 'Foo'}, {strict: true})
}, new Error('Invalid name: "Foo"'), 'should throw an error')
t.doesNotThrow(function () {
fixer.fixNameField({name: 'Foo'}, {strict: true, allowLegacyCase: true})
})
t.end()
})