]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/normalize-package-data/test/mixedcase-names.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / normalize-package-data / test / mixedcase-names.js
diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/normalize-package-data/test/mixedcase-names.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/normalize-package-data/test/mixedcase-names.js
new file mode 100644 (file)
index 0000000..a62b699
--- /dev/null
@@ -0,0 +1,32 @@
+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()
+})