diff options
Diffstat (limited to 'deps/npm/node_modules/npm-registry-client/test/adduser-update.js')
-rw-r--r-- | deps/npm/node_modules/npm-registry-client/test/adduser-update.js | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/deps/npm/node_modules/npm-registry-client/test/adduser-update.js b/deps/npm/node_modules/npm-registry-client/test/adduser-update.js index 6732f7ba0e5..18aad3ebe4b 100644 --- a/deps/npm/node_modules/npm-registry-client/test/adduser-update.js +++ b/deps/npm/node_modules/npm-registry-client/test/adduser-update.js @@ -1,51 +1,50 @@ -var tap = require("tap") +var tap = require('tap') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') var client = common.freshClient() -var password = "%1234@asdf%" -, username = "username" -, email = "i@izs.me" -, userdata = { +var password = '%1234@asdf%' +var username = 'username' +var email = 'i@izs.me' +var userdata = { name: username, email: email, - _id: "org.couchdb.user:username", - type: "user", + _id: 'org.couchdb.user:username', + type: 'user', roles: [], - date: "2012-06-07T04:11:21.591Z" } -, SD = require("string_decoder").StringDecoder -, decoder = new SD() + date: '2012-06-07T04:11:21.591Z' } +var SD = require('string_decoder').StringDecoder +var decoder = new SD() - -tap.test("update a user acct", function (t) { +tap.test('update a user acct', function (t) { var auth = { - username : username, - password : password, - email : email + username: username, + password: password, + email: email } - var params = { auth : auth } + var params = { auth: auth } - server.expect("PUT", "/-/user/org.couchdb.user:username", function (req, res) { - t.equal(req.method, "PUT") + server.expect('PUT', '/-/user/org.couchdb.user:username', function (req, res) { + t.equal(req.method, 'PUT') res.statusCode = 409 - res.json({error: "conflict"}) + res.json({error: 'conflict'}) }) - server.expect("GET", "/-/user/org.couchdb.user:username?write=true", function (req, res) { - t.equal(req.method, "GET") + server.expect('GET', '/-/user/org.couchdb.user:username?write=true', function (req, res) { + t.equal(req.method, 'GET') res.json(userdata) }) - server.expect("PUT", "/-/user/org.couchdb.user:username/-rev/" + userdata._rev, function (req, res) { - t.equal(req.method, "PUT") + server.expect('PUT', '/-/user/org.couchdb.user:username/-rev/' + userdata._rev, function (req, res) { + t.equal(req.method, 'PUT') - var b = "" - req.on("data", function (d) { + var b = '' + req.on('data', function (d) { b += decoder.write(d) }) - req.on("end", function () { + req.on('end', function () { var o = JSON.parse(b) userdata.password = password userdata.date = o.date @@ -57,11 +56,11 @@ tap.test("update a user acct", function (t) { }) client.adduser( - "http://localhost:1337/", + 'http://localhost:1337/', params, function (er, data) { if (er) throw er - t.deepEqual(data, auth, "got expected auth data") + t.deepEqual(data, auth, 'got expected auth data') t.end() } ) |