diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-07-21 09:36:01 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-07-21 09:36:01 +0200 |
commit | 5662c0bce32f9302fbdcedf583940482b5d2822a (patch) | |
tree | 2de5c9b7914fb129823a7cb5bf8f5b2a2d806ab8 /tests | |
parent | 8b90a189a3a341791796a71df856c6a2880ee319 (diff) | |
download | bugzilla-triage-5662c0bce32f9302fbdcedf583940482b5d2822a.tar.gz |
Add a test for empty list paramter of util.filterByRegexp function.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-util.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/test-util.js b/tests/test-util.js index 54896ff..b10d485 100644 --- a/tests/test-util.js +++ b/tests/test-util.js @@ -83,14 +83,22 @@ exports.ensureFilterByRegexp = function (test) { } ]; - test.assertEqual(util.filterByRegexp(list,"testing"),"correct", + test.assertEqual(util.filterByRegexp(list, "testing"), "correct", "simple testing of filterByRegexp"); - test.assertEqual(util.filterByRegexp(list,"unknown value"),"", + test.assertEqual(util.filterByRegexp(list, "unknown value"), "", "simple testing of filterByRegexp with non-found address"); - test.assert(util.filterByRegexp(list,"baaad"), + test.assert(util.filterByRegexp(list, "baaad"), "simple testing of filterByRegexp with non-string return value"); }; +exports.ensureFilterByRegexpEmpty = function (test) { + test.assertRaises(function () { + util.filterByRegexp(undefined, "tralala"); + }, + "list is undefined", + "filterByRegexp throws an exception with empty list"); +}; + // testing util.getISODate exports.ensureGetISODate = function (test) { test.assertEqual(util.getISODate("Mon May 31 2010 23:29:09 GMT+0200 (CET)"), @@ -175,6 +183,6 @@ exports.ensureGetObjectKeys = function (test) { b: 2 }; test.assertEqual(JSON.stringify(util.getObjectKeys(testObj)), - JSON.stringify(["a","b"]), + JSON.stringify(["a", "b"]), "getting keys from a object"); };
\ No newline at end of file |