aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-02-15 00:37:57 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-02-15 00:37:57 +0100
commit10dcf8de5c6965832452c538451d6170b3bafb66 (patch)
tree26a485d017ce2d3ea2032293687827f6c6d3a3e8 /tests
parent04657077ba12e8f23feaa0c3787b590c44446056 (diff)
downloadbugzilla-triage-10dcf8de5c6965832452c538451d6170b3bafb66.tar.gz
Bit of reorganization
Also add an event handler on changes in assigned_to input box
Diffstat (limited to 'tests')
-rw-r--r--tests/test-color.js10
-rw-r--r--tests/test-util.js44
2 files changed, 27 insertions, 27 deletions
diff --git a/tests/test-color.js b/tests/test-color.js
index 7394057..2006fd9 100644
--- a/tests/test-color.js
+++ b/tests/test-color.js
@@ -1,30 +1,30 @@
/*global exports: false, require: false */
// TODO: add some failing tests as well
"use strict";
-var util = require("color");
+//var util = require("color");
// testing Color object
-exports.ensureColorNew = function (test) {
+var ensureColorNew = function (test) {
var col = new util.Color(255, 255, 166);
test.assertEqual(col.toString(), "#ffffa6",
"creation of new RGB Color object");
};
-exports.ensureColorUpdate = function (test) {
+var ensureColorUpdate = function (test) {
var col = new util.Color(255, 255, 166);
col.update(255, 224, 176);
test.assertEqual(col.toString(), "#ffe0b0",
"updating Color object");
};
-exports.ensureColorHSL = function (test) {
+var ensureColorHSL = function (test) {
var col = new util.Color(255, 224, 176);
test.assertEqual(col.hsl().toSource(),
"[0.10126582278481013, 1, 0.8450980392156863]",
"converting to HSL model");
};
-exports.ensureColorLight = function (test) {
+var ensureColorLight = function (test) {
var col = new util.Color(255, 224, 176);
test.assertEqual(col.lightColor().toString(), "#e8dcc9",
"getting a light color");
diff --git a/tests/test-util.js b/tests/test-util.js
index 9acb54c..d4e4a78 100644
--- a/tests/test-util.js
+++ b/tests/test-util.js
@@ -6,7 +6,7 @@ var util = require("util");
var urlMod = require("url");
// testing util.heir
-exports.ensureHeir = function (test) {
+var ensureHeir = function (test) {
var fedlimid = {}, naoise = {};
function Father(x) {
@@ -51,28 +51,28 @@ exports.ensureHeir = function (test) {
};
// testing util.isInList
-exports.ensureIsInListTrue = function (test) {
+var ensureIsInListTrue = function (test) {
test.assert(util.isInList("a", ["a"]),
"conversion of a string to an array");
};
-exports.ensureIsInListFalse = function (test) {
+var ensureIsInListFalse = function (test) {
test.assert(!util.isInList("b", ["a"]),
"conversion of a string to an array");
};
-exports.ensureIsInListEmpty = function (test) {
+var ensureIsInListEmpty = function (test) {
test.assert(!util.isInList("b", []),
"conversion of a string to an array");
};
-exports.ensureIsInListNoMember = function (test) {
+var ensureIsInListNoMember = function (test) {
test.assert(!util.isInList("", ["x"]),
"conversion of a string to an array");
};
// testing util.filterByRegexp
-exports.ensureFilterByRegexp = function (test) {
+var ensureFilterByRegexp = function (test) {
var list = [
{
"regexp": "test(ing|ed)",
@@ -92,7 +92,7 @@ exports.ensureFilterByRegexp = function (test) {
"simple testing of filterByRegexp with non-string return value");
};
-exports.ensureFilterByRegexpEmpty = function (test) {
+var ensureFilterByRegexpEmpty = function (test) {
test.assertRaises(function () {
util.filterByRegexp(undefined, "tralala");
},
@@ -101,78 +101,78 @@ exports.ensureFilterByRegexpEmpty = function (test) {
};
// testing util.getISODate
-exports.ensureGetISODate = function (test) {
+var ensureGetISODate = function (test) {
test.assertEqual(util.getISODate("Mon May 31 2010 23:29:09 GMT+0200 (CET)"),
"2010-05-31", "conversion of a Date to ISO-formatted String");
};
// testing util.valToArray
-exports.ensureValToArrayString = function (test) {
+var ensureValToArrayString = function (test) {
test.assertEqual(JSON.stringify(util.valToArray("a")),
JSON.stringify(["a"]),
"conversion of a string to an array");
};
-exports.ensureValToArrayEmpty = function (test) {
+var ensureValToArrayEmpty = function (test) {
test.assertEqual(JSON.stringify(util.valToArray("")),
JSON.stringify([""]),
"conversion of an empty string to an array");
};
-exports.ensureValToArrayArray = function (test) {
+var ensureValToArrayArray = function (test) {
test.assertEqual(JSON.stringify(util.valToArray(["a"])),
JSON.stringify(["a"]),
"non-conversion of an array");
};
// testing util.addCSVValue
-exports.ensureCSVAddedToNull = function (test) {
+var ensureCSVAddedToNull = function (test) {
test.assertEqual(util.addCSVValue("", "b"), "b",
"adding a string to empty string");
};
-exports.ensureCSVAddedNull = function (test) {
+var ensureCSVAddedNull = function (test) {
test.assertEqual(util.addCSVValue("a", ""), "a",
"adding nothing to a string");
};
-exports.ensureCSVAddedString = function (test) {
+var ensureCSVAddedString = function (test) {
test.assertEqual(util.addCSVValue("a", "b"), "a, b",
"adding one string to another one");
};
-exports.ensureCSVAddedArray = function (test) {
+var ensureCSVAddedArray = function (test) {
test.assertEqual(util.addCSVValue("a", ["b", "c"]), "a, b, c",
"adding array to a string");
};
-exports.ensureCSVAddedArray2Array = function (test) {
+var ensureCSVAddedArray2Array = function (test) {
test.assertEqual(util.addCSVValue("a, b", ["c", "d"]), "a, b, c, d",
"adding one array to another");
};
// testing util.removeCSVValue
-exports.ensureCSVRemoveSimple = function (test) {
+var ensureCSVRemoveSimple = function (test) {
test.assertEqual(util.removeCSVValue("a, b", "b"), "a",
"removing one string from an array");
};
// also checking a tolerancy against different ways of writing arrays
-exports.ensureCSVRemoveNonMember = function (test) {
+var ensureCSVRemoveNonMember = function (test) {
test.assertEqual(util.removeCSVValue("a,b", "c"), "a, b",
"removing a string from an array of which it isn't a member");
};
-exports.ensureCSVRemoveEmpty = function (test) {
+var ensureCSVRemoveEmpty = function (test) {
test.assertEqual(util.removeCSVValue("", "c"), "",
"removing a string from an empty array");
};
// testing util.getObjectKeys
-exports.ensureGetObjectKeys = function (test) {
+var ensureGetObjectKeys = function (test) {
var testObj = {
a: 1,
b: 2
@@ -183,7 +183,7 @@ exports.ensureGetObjectKeys = function (test) {
};
// testing util.getParamsFromURL
-exports.ensureGetParamsFromURL = function (test) {
+var ensureGetParamsFromURL = function (test) {
test.assertEqual(JSON.stringify(util.getParamsFromURL("https://bugzilla.redhat.com/show_bug.cgi?id=549066")),
JSON.stringify({id:"549066"}),
"simply compare result of bugzilla show_page URL");
@@ -206,7 +206,7 @@ exports.ensureGetParamsFromURL = function (test) {
};
// testing util.getBugNo
-exports.ensureGetBugNo = function (test) {
+var ensureGetBugNo = function (test) {
var bugNo = util.getBugNo("https://bugzilla.redhat.com/show_bug.cgi?id=597141");
test.assertEqual(bugNo, 597141, "getting bug number");
bugNo = util.getBugNo("https://bugzilla.redhat.com/show_bug.cgi?id=serialWacom");