Why does only one test seem to be processed

This commit is contained in:
Jake 2015-02-11 18:25:56 -06:00
parent 2c1173b8a5
commit 5a06e99643
2 changed files with 114 additions and 110 deletions

View File

@ -45,8 +45,12 @@ module.exports = function(req, res) {
userId = userId.replace(/-/g, ""); userId = userId.replace(/-/g, "");
logging.log(rid + "userid: " + userId); logging.log(rid + "userid: " + userId);
console.log("THIS WAS CALLED")
try { try {
console.log("TRIED")
helpers.get_avatar(rid, userId, helm, size, function(err, status, image, hash) { helpers.get_avatar(rid, userId, helm, size, function(err, status, image, hash) {
console.log("I DID RUN COVERALLS!!")
logging.log(rid + "storage type: " + human_status[status]); logging.log(rid + "storage type: " + human_status[status]);
if (err) { if (err) {
logging.error(rid + err); logging.error(rid + err);
@ -72,6 +76,7 @@ module.exports = function(req, res) {
} }
}); });
} catch(e) { } catch(e) {
console.log("FAILED")
logging.error(rid + "error: " + e.stack); logging.error(rid + "error: " + e.stack);
handle_default(rid, 500, -1, userId); handle_default(rid, 500, -1, userId);
} }

View File

@ -1,6 +1,5 @@
var assert = require("assert"); var assert = require("assert");
var fs = require("fs"); var fs = require("fs");
var networking = require("../modules/networking"); var networking = require("../modules/networking");
var helpers = require("../modules/helpers"); var helpers = require("../modules/helpers");
var logging = require("../modules/logging"); var logging = require("../modules/logging");
@ -34,8 +33,8 @@ function getRandomInt(min, max) {
var ids = [ var ids = [
uuid.toLowerCase(), uuid.toLowerCase(),
name.toLowerCase(), name.toLowerCase(),
uuid.toUpperCase(),
name.toUpperCase(), name.toUpperCase(),
uuid.toUpperCase(),
]; ];
describe("Crafatar", function() { describe("Crafatar", function() {
@ -241,6 +240,12 @@ describe("Server", function() {
var locations = ["avatars", "capes", "skins", "renders/head"] var locations = ["avatars", "capes", "skins", "renders/head"]
for (var l in locations) { for (var l in locations) {
var location = locations[l]; var location = locations[l];
it("should return a 200 (valid input " + location + ")", function(done) {
request.get("http://localhost:3000/" + location + "/Jake0oo0", function(error, res, body) {
assert.equal(200, res.statusCode);
done();
});
});
it("should return a 422 (invalid id " + location + ")", function(done) { it("should return a 422 (invalid id " + location + ")", function(done) {
request.get("http://localhost:3000/" + location + "/thisisaninvaliduuid", function(error, res, body) { request.get("http://localhost:3000/" + location + "/thisisaninvaliduuid", function(error, res, body) {
assert.equal(422, res.statusCode); assert.equal(422, res.statusCode);
@ -248,12 +253,6 @@ describe("Server", function() {
}); });
}); });
it("should return a 200 (valid input " + location + ")", function(done) {
request.get("http://localhost:3000/" + location + "/Jake0oo0", function(error, res, body) {
assert.equal(200, res.statusCode);
done();
});
});
} }
// testing all paths for default images // testing all paths for default images