summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-registry-client/test/upload.js
blob: 8884db8f33a47bfeab611c3db1e3de59290a3978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var tap = require("tap")
var Readable = require("stream").Readable
var inherits = require("util").inherits

var common = require("./lib/common.js")
var server = require("./lib/server.js")

var cache = require("./fixtures/underscore/cache.json")

var client = common.freshClient({
  username      : "othiym23",
  password      : "password",
  email         : "ogd@aoaioxxysz.net",
  _auth         : new Buffer("username  : password").toString("base64"),
  "always-auth" : true
})

function OneA() {
  Readable.call(this)
  this.push("A")
  this.push(null)
}
inherits(OneA, Readable)

tap.test("unpublish a package", function (t) {
  server.expect("PUT", "/underscore", function (req, res) {
    t.equal(req.method, "PUT")

    res.json(cache)
  })

  client.upload("http://localhost:1337/underscore", new OneA(), "daedabeefa", true, function (error) {
    t.notOk(error, "no errors")

    t.end()
  })
})