]> 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/scoped.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 / scoped.js
diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/normalize-package-data/test/scoped.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/normalize-package-data/test/scoped.js
new file mode 100644 (file)
index 0000000..82d2a54
--- /dev/null
@@ -0,0 +1,59 @@
+var test = require("tap").test
+
+var fixNameField = require("../lib/fixer.js").fixNameField
+var fixBinField = require("../lib/fixer.js").fixBinField
+
+test("a simple scoped module has a valid name", function (t) {
+  var data = {name : "@org/package"}
+  fixNameField(data, false)
+  t.equal(data.name, "@org/package", "name was unchanged")
+
+  t.end()
+})
+
+test("'org@package' is not a valid name", function (t) {
+  t.throws(function () {
+    fixNameField({name : "org@package"}, false)
+  }, "blows up as expected")
+
+  t.end()
+})
+
+test("'org=package' is not a valid name", function (t) {
+  t.throws(function () {
+    fixNameField({name : "org=package"}, false)
+  }, "blows up as expected")
+
+  t.end()
+})
+
+test("'@org=sub/package' is not a valid name", function (t) {
+  t.throws(function () {
+    fixNameField({name : "@org=sub/package"}, false)
+  }, "blows up as expected")
+
+  t.end()
+})
+
+test("'@org/' is not a valid name", function (t) {
+  t.throws(function () {
+    fixNameField({name : "@org/"}, false)
+  }, "blows up as expected")
+
+  t.end()
+})
+
+test("'@/package' is not a valid name", function (t) {
+  t.throws(function () {
+    fixNameField({name : "@/package"}, false)
+  }, "blows up as expected")
+
+  t.end()
+})
+
+test("name='@org/package', bin='bin.js' is bin={package:'bin.js'}", function (t) {
+  var obj = {name : "@org/package", bin: "bin.js"}
+  fixBinField(obj)
+  t.isDeeply(obj.bin, {package: 'bin.js'})
+  t.end()
+})