Permalink
Browse files

Zero in on failing test

  • Loading branch information...
davidmerfield committed Nov 20, 2018
1 parent 1cba271 commit ae2dc5ce48966aa5ad9d892e0100d9d9ef95636e
Showing with 12 additions and 8 deletions.
  1. +12 −8 app/blog/tests/assets.js
@@ -1,4 +1,4 @@
describe("asset middleware", function() {
fdescribe("asset middleware", function() {
var Express = require("express");
var fs = require("fs-extra");
var http = require("http");
@@ -41,7 +41,7 @@ describe("asset middleware", function() {
});
});
// This test ensures that the middleware will pass
// This test ensures that the middleware will pass
// the request on if it can't find a matching file.
it("returns a 404 correctly", function(done) {
this.get("/" + this.fake.random.uuid(), function(err, body, res) {
@@ -75,14 +75,18 @@ describe("asset middleware", function() {
});
ctx.server.use(require("../assets"));
ctx.server = ctx.server.listen(port, function(err) {
if (err && err.code === "EADDRINUSE") return attempt(done);
if (err && err.code === "EACCESS") return attempt(done);
if (err) return done(err);
done();
});
try {
ctx.server = ctx.server.listen(port);
} catch (err) {
if (err.code === "EADDRINUSE") return attempt(done);
if (err.code === "EACCESS") return attempt(done);
return done(err);
}
ctx.server.port = port;
ctx.url = "http://localhost:" + port;
done();
})(done);
});

0 comments on commit ae2dc5c

Please sign in to comment.