]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npm-registry-client/test/publish-failed-no-message.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / npm-registry-client / test / publish-failed-no-message.js
1 var createReadStream = require('fs').createReadStream
2
3 var test = require('tap').test
4
5 var server = require('./lib/server.js')
6 var common = require('./lib/common.js')
7 var config = { retry: { retries: 0 } }
8 var client = common.freshClient(config)
9
10 var URI = 'http://localhost:1337/'
11 var USERNAME = 'username'
12 var PASSWORD = '%1234@asdf%'
13 var EMAIL = 'i@izs.me'
14 var METADATA = require('../package.json')
15 var ACCESS = 'public'
16 // not really a tarball, but doesn't matter
17 var BODY_PATH = require.resolve('../package.json')
18 var BODY = createReadStream(BODY_PATH)
19 var AUTH = {
20   username: USERNAME,
21   password: PASSWORD,
22   email: EMAIL
23 }
24 var PARAMS = {
25   metadata: METADATA,
26   access: ACCESS,
27   body: BODY,
28   auth: AUTH
29 }
30
31 test('publish with a 500 response but no message', function (t) {
32   server.expect('/npm-registry-client', function (req, res) {
33     res.statusCode = 500
34     res.json({ success: false })
35   })
36
37   client.publish(URI, PARAMS, function (er, data) {
38     t.ok(er, 'got expected error')
39     t.notOk(data, 'no payload on failure')
40
41     server.close()
42     t.end()
43   })
44 })