Add utils for testing.

master
PJ Hampton 2017-04-28 12:36:32 +00:00
parent 4bd79a4c13
commit 1d2606ae16
2 changed files with 37 additions and 8 deletions

View File

@ -119,7 +119,6 @@ DDH.conversions = DDH.conversions || {};
}
} // Converter
var Utils = {
// caches the local DOM vars
@ -284,4 +283,7 @@ DDH.conversions = DDH.conversions || {};
}// on show
}; // return
}; // DDH.conversions.build
module.exports = { Converter, Utils };
})(DDH);

View File

@ -1,13 +1,40 @@
GLOBAL.DDH = {};
describe("Conversions", function() {
// Imports / Obj References
var conversions_goodie = require("../share/goodie/conversions/conversions.js");
var Converter = conversions_goodie.Converter;
var Utils = conversions_goodie.Utils;
it("should be able to add two numbers", function() {
expect(true).toEqual(false);
});
//
// Utils
//
describe("Conversion Utils", function() {
it("The string `20` should be a number", function() {
expect(Utils.isNumber("20")).toEqual(true);
});
it("should be able to subtract two numbers", function() {
expect(true).toEqual(true);
});
it("The string `-50` should be a number", function() {
expect(Utils.isNumber("-50")).toEqual(true);
});
it("The string `50.321` should be a number", function() {
expect(Utils.isNumber("50.321")).toEqual(true);
});
it("The string `dax` shouldn't be a number", function() {
expect(Utils.isNumber("dax")).toEqual(false);
});
it("The string `DuckDuckGo.com` shouldn't be a number", function() {
expect(Utils.isNumber("DuckDuckGo.com")).toEqual(false);
});
it("The raw number `60` should be a number", function() {
expect(Utils.isNumber(60)).toEqual(true);
});
it("The raw boolean true shouldn't be a number", function() {
expect(Utils.isNumber(true)).toEqual(false);
});
});