Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 10d4d4c

Browse files
committed
1 parent a8d3193 commit 10d4d4c

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"devDependencies": {
2828
"negotiator": "^0.4.9",
2929
"nock": "^0.56.0",
30-
"standard": "^3.2.0",
31-
"tap": ""
30+
"standard": "^4.0.0",
31+
"tap": "^1.2.0"
3232
},
3333
"optionalDependencies": {
3434
"npmlog": ""

test/get-403.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
t.end()
27+
}
28+
)
29+
})

0 commit comments

Comments
 (0)