Initial commit
[yaffs-website] / node_modules / normalize-package-data / test / mixedcase-names.js
1 var test = require('tap').test
2
3 var normalize = require('../')
4 var fixer = normalize.fixer
5
6 test('mixedcase', function (t) {
7   t.doesNotThrow(function () {
8     fixer.fixNameField({name: 'foo'}, true)
9   })
10
11   t.doesNotThrow(function () {
12     fixer.fixNameField({name: 'foo'}, false)
13   })
14
15   t.doesNotThrow(function () {
16     fixer.fixNameField({name: 'foo'})
17   })
18
19   t.throws(function () {
20     fixer.fixNameField({name: 'Foo'}, true)
21   }, new Error('Invalid name: "Foo"'), 'should throw an error')
22
23   t.throws(function () {
24     fixer.fixNameField({name: 'Foo'}, {strict: true})
25   }, new Error('Invalid name: "Foo"'), 'should throw an error')
26
27   t.doesNotThrow(function () {
28     fixer.fixNameField({name: 'Foo'}, {strict: true, allowLegacyCase: true})
29   })
30
31   t.end()
32 })