summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-registry-client/test/publish.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npm-registry-client/test/publish.js')
-rw-r--r--deps/npm/node_modules/npm-registry-client/test/publish.js43
1 files changed, 21 insertions, 22 deletions
diff --git a/deps/npm/node_modules/npm-registry-client/test/publish.js b/deps/npm/node_modules/npm-registry-client/test/publish.js
index 9dcfc33740..a6233905f3 100644
--- a/deps/npm/node_modules/npm-registry-client/test/publish.js
+++ b/deps/npm/node_modules/npm-registry-client/test/publish.js
@@ -1,24 +1,23 @@
-var tap = require('tap')
-var crypto = require('crypto')
-var server = require('./fixtures/server.js')
-var RC = require('../')
-var client = new RC(
- { cache: __dirname + '/fixtures/cache'
- , registry: 'http://localhost:' + server.port
- , username: "username"
- , password: "password"
- , email: "i@izs.me"
- , _auth: new Buffer("username:password").toString('base64')
- , "always-auth": true
- })
-
+var tap = require("tap")
+var crypto = require("crypto")
var fs = require("fs")
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username: "username",
+ password: "password",
+ email: "i@izs.me",
+ _auth: new Buffer("username:password").toString("base64"),
+ "always-auth": true
+})
+
+
tap.test("publish", function (t) {
server.expect("/npm-registry-client", function (req, res) {
t.equal(req.method, "PUT")
var b = ""
- req.setEncoding('utf8')
+ req.setEncoding("utf8")
req.on("data", function (d) {
b += d
})
@@ -28,11 +27,11 @@ tap.test("publish", function (t) {
t.equal(o._id, "npm-registry-client")
t.equal(o["dist-tags"].latest, pkg.version)
t.has(o.versions[pkg.version], pkg)
- t.same(o.maintainers, [ { name: 'username', email: 'i@izs.me' } ])
+ t.same(o.maintainers, [ { name: "username", email: "i@izs.me" } ])
t.same(o.maintainers, o.versions[pkg.version].maintainers)
- var att = o._attachments[ pkg.name + '-' + pkg.version + '.tgz' ]
+ var att = o._attachments[ pkg.name + "-" + pkg.version + ".tgz" ]
t.same(att.data, pd)
- var hash = crypto.createHash('sha1').update(pd, 'base64').digest('hex')
+ var hash = crypto.createHash("sha1").update(pd, "base64").digest("hex")
t.equal(o.versions[pkg.version].dist.shasum, hash)
res.statusCode = 201
res.json({created:true})
@@ -40,10 +39,10 @@ tap.test("publish", function (t) {
})
// not really a tarball, but doesn't matter
- var tarball = require.resolve('../package.json')
- var pd = fs.readFileSync(tarball, 'base64')
- var pkg = require('../package.json')
- client.publish(pkg, tarball, function (er, data, raw, res) {
+ var tarball = require.resolve("../package.json")
+ var pd = fs.readFileSync(tarball, "base64")
+ var pkg = require("../package.json")
+ client.publish("http://localhost:1337/", pkg, tarball, function (er, data) {
if (er) throw er
t.deepEqual(data, { created: true })
t.end()