From c062348f40b421dcf54eb1f678c232da6321e603 Mon Sep 17 00:00:00 2001 From: Jake Date: Wed, 11 Feb 2015 20:16:55 -0600 Subject: [PATCH] Separate some test loops --- test/test.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/test/test.js b/test/test.js index 32115d1..2716f28 100644 --- a/test/test.js +++ b/test/test.js @@ -236,19 +236,31 @@ describe("Server", function() { }); }); + // testing all paths for valid inputs + var locations = ["avatars", "skins", "renders/head"] + for (var l in locations) { + var location = locations[l]; + (function(location) { + 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) { + request.get("http://localhost:3000/" + location + "/thisisaninvaliduuid", function(error, res, body) { + assert.equal(422, res.statusCode); + done(); + }); + }); + })(location); + } + // testing all paths for invalid id formats var locations = ["avatars", "capes", "skins", "renders/head"] for (var l in locations) { var location = locations[l]; (function(location) { - if (location !== "capes") { - 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) { request.get("http://localhost:3000/" + location + "/thisisaninvaliduuid", function(error, res, body) { assert.equal(422, res.statusCode);