-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from foundersandcoders/angulartokentactics
Angulartokentactics
- Loading branch information
Showing
10 changed files
with
207 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var test = require("tape"); | ||
var cacheprotocol = require("../../server/lib/cacheprotocol.js"); | ||
|
||
test("cacheprotocol should contain a function", function(t) { | ||
|
||
t.equals(typeof cacheprotocol, "function", "cacheprotocol is a function"); | ||
t.end(); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
var test = require("tape"); | ||
var capitalize = require("../../server/lib/capitalize.js"); | ||
|
||
var ins = ["hello", "euhaoeusnht", "William"]; | ||
var outs = ["Hello", "Euhaoeusnht", "William"]; | ||
|
||
|
||
test("capitalize should be a function", function(t) { | ||
|
||
t.equals(typeof capitalize, "function", "capitalize is a function"); | ||
t.end(); | ||
|
||
}); | ||
|
||
|
||
test("capitalize should return input if not a string", function(t) { | ||
|
||
t.equals(typeof capitalize(), "undefined", "capitalize() returns undefined"); | ||
t.equals(typeof capitalize(function(){}), "function", "capitalize(function({}) returns function"); | ||
t.equals(typeof capitalize({test: "hello"}), "object", "capitalize({}) returns object"); | ||
t.equals(typeof capitalize(3), "number", "capitalize(3) returns number"); | ||
t.end(); | ||
|
||
}); | ||
|
||
|
||
ins.map(function(w, i) { | ||
|
||
test("capitalize should return word with capitalized first lettef if input is a string", function(t) { | ||
|
||
t.equals(capitalize(w), outs[i], ins[i] + " returns " + outs[i]); | ||
t.end(); | ||
|
||
}); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
var test = require("tape"); | ||
var clean = require("../../server/lib/cleanobj.js"); | ||
|
||
test("cleanobj.js should contain a function", function(t) { | ||
|
||
t.equals(typeof clean, "function", "cleanobj.js is a function"); | ||
t.end(); | ||
|
||
}); | ||
|
||
test("String.prototype should have method 'contains'", function(t) { | ||
|
||
t.ok(String.prototype.hasOwnProperty("contains"), "String.prototype.contains exists"); | ||
t.equals(typeof String.prototype.contains, "function", "String.prototype.contains is a function"); | ||
t.end(); | ||
|
||
}); | ||
|
||
|
||
test("String.prototype.contains should return true if string contains input", function(t) { | ||
|
||
t.equals("HELLO".contains("O"), true, "'HELLO'.contains('O') is true"); | ||
t.equals("eeee".contains(9), false, "'eeee'.contains(9) is false"); | ||
t.end(); | ||
|
||
}); | ||
|
||
|
||
test("cleanobj should only change properties that are strings and don't contain http://", function(t) { | ||
|
||
var obj = { | ||
hello: ["heueu", 334], | ||
dog: true, | ||
url: "http://euaoeuaou", | ||
cat: 93939 | ||
}; | ||
|
||
Object.keys(obj).map(function(k) { | ||
t.equals(clean(obj)[k], obj[k], "obj." + k + " is unchanged"); | ||
}); | ||
|
||
t.end(); | ||
|
||
}); | ||
|
||
|
||
test("cleanobj should change all / to 'and' in string properties", function(t) { | ||
|
||
var obj = { | ||
yes: "eaosuh/aouea", | ||
no: "eaosuh/aouea/euaoeu", | ||
maybe: "aueoths/" | ||
}; | ||
var objProcessed = { | ||
yes: "eaosuh and aouea", | ||
no: "eaosuh and aouea and euaoeu", | ||
maybe: "aueoths and " | ||
}; | ||
|
||
Object.keys(obj).map(function(k) { | ||
t.equals(clean(obj)[k], objProcessed[k], "obj." + k + " has been changed"); | ||
}); | ||
|
||
t.end(); | ||
|
||
|
||
}); | ||
|
||
|
||
test("String.prototype.contains should not be overwritten if it exists", function(t) { | ||
|
||
String.prototype.contains = function() { | ||
return true; | ||
}; | ||
clean = require("../../server/lib/cleanobj.js"); | ||
t.equals("".contains(), true, "String.prototype.contains has not been overwritten"); | ||
t.end(); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var test = require("tape"); | ||
var mapUri = require("../../server/lib/mapUri.js"); | ||
|
||
test("mapUri should contain an object", function(t) { | ||
|
||
t.equals(typeof mapUri, "object", "mapUri contains a function"); | ||
t.ok(mapUri.hasOwnProperty("mapUri"), "mapUri.mapUri exists"); | ||
t.ok(mapUri.hasOwnProperty("mapQuery"), "mapUri.mapQuery exists"); | ||
t.ok(mapUri.hasOwnProperty("mapStreetworks"), "mapUri.mapStreetworks exists"); | ||
t.ok(mapUri.hasOwnProperty("mapLocalInformation"), "mapUri.mapLocalInformation exists"); | ||
|
||
t.end(); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var test = require("tape"); | ||
var server = require("../../server/server.js"); | ||
var request = require("request"); | ||
|
||
var apiUrl = "http://0.0.0.0:8080"; | ||
|
||
server.start(function(){ | ||
console.log("server started and tests running ..."); | ||
|
||
}); | ||
|
||
|
||
test("server should contain an object"); | ||
|
||
|
||
test("server should contain an object"); | ||
test("server should contain an object"); | ||
test("server should contain an object"); | ||
test("server should contain an object"); | ||
test("server should contain an object"); | ||
test("server should contain an object"); | ||
test("server should contain an object"); | ||
test("server should contain an object"); | ||
test("server should contain an object"); | ||
test("server should contain an object"); |