]> 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/get-403.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 / get-403.js
1 var tap = require('tap')
2
3 var server = require('./lib/server.js')
4 var common = require('./lib/common.js')
5
6 tap.test('get returns 403', function (t) {
7   server.expect('/underscore', function (req, res) {
8     t.equal(req.method, 'GET', 'got expected method')
9
10     res.writeHead(403)
11     res.end(JSON.stringify({
12       error: 'get that cat out of the toilet that\'s gross omg'
13     }))
14   })
15
16   var client = common.freshClient()
17   client.get(
18     'http://localhost:1337/underscore',
19     {},
20     function (er) {
21       t.ok(er, 'failed as expected')
22
23       t.equal(er.statusCode, 403, 'status code was attached to error as expected')
24       t.equal(er.code, 'E403', 'error code was formatted as expected')
25
26       server.close()
27       t.end()
28     }
29   )
30 })