Created
September 11, 2014 22:25
-
-
Save othiym23/31ca9f39ac2911986b09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tap = require("tap") | |
var server = require("./lib/server.js") | |
var common = require("./lib/common.js") | |
tap.test("get returns 403", function (t) { | |
server.expect("/underscore", function (req, res) { | |
t.equal(req.method, "GET", "got expected method") | |
res.writeHead(403) | |
res.end("{\"error\":\"get that cat out of the toilet that's gross omg\"}") | |
}) | |
var client = common.freshClient() | |
client.get( | |
"http://localhost:1337/underscore", | |
{}, | |
function (er) { | |
t.ok(er, "failed as expected") | |
t.equal(er.statusCode, 403, "status code was attached to error as expected") | |
t.equal(er.code, "E403", "error code was formatted as expected") | |
t.end() | |
} | |
) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment