X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Ftest%2Ftap%2Fpublish-access-unscoped.js;fp=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Ftest%2Ftap%2Fpublish-access-unscoped.js;h=4d193cffd99a77a12594a35483c2d99255c2fd84;hb=2529be6d456deeb07c128603ce4971f1dc29b695;hp=0000000000000000000000000000000000000000;hpb=2636fc31c16c23711cf2b06a4ae8537bba9c1d35;p=simantics%2Fdistrict.git diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/publish-access-unscoped.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/publish-access-unscoped.js new file mode 100644 index 00000000..4d193cff --- /dev/null +++ b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/publish-access-unscoped.js @@ -0,0 +1,73 @@ +var fs = require("fs") +var path = require("path") + +var test = require('tap').test +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var mr = require('npm-registry-mock') +var common = require('../common-tap') +var server + +var pkg = path.join(__dirname, "publish-access-unscoped") + +test('setup', function (t) { + mr({port: common.port, throwOnUnmatched: true}, function (err, s) { + t.ifError(err, 'registry mocked successfully') + t.pass('setup done') + server = s + t.end() + }) +}) + +test('unscoped packages can be explicitly set as public', function (t) { + server.filteringRequestBody(function (body) { + t.doesNotThrow(function () { + var parsed = JSON.parse(body) + t.equal(parsed.access, 'public', 'access level is correct') + }, 'converted body back into object') + return true + }).put('/publish-access', true).reply(201, {ok: true}) + + mkdirp(path.join(pkg, 'cache'), function () { + fs.writeFile( + path.join(pkg, "package.json"), + JSON.stringify({ + name: 'publish-access', + version: '1.2.5', + public: true + }), + "ascii", + function (er) { + t.ifError(er, 'package file written') + common.npm( + [ + 'publish', + '--access', 'public', + '--cache', path.join(pkg, 'cache'), + '--loglevel', 'silly', + '--registry', common.registry + ], + { + cwd: pkg + }, + function (er) { + t.ifError(er, 'published without error') + + server.done() + t.end() + } + ) + } + ) + }) +}) + +test("cleanup", function (t) { + process.chdir(__dirname) + server.close() + rimraf(pkg, function (er) { + t.ifError(er) + + t.end() + }) +})