diff options
-rw-r--r-- | lib/bzpage.js | 9 | ||||
-rw-r--r-- | lib/util.js | 7 | ||||
-rw-r--r-- | tests/test-util.js | 2 |
3 files changed, 8 insertions, 10 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js index 608e21e..635ec7d 100644 --- a/lib/bzpage.js +++ b/lib/bzpage.js @@ -142,15 +142,6 @@ var BZPage = function BZPage(win, config) { }; /** - * Get the ID of the bug. - * - * @return string - */ -BZPage.prototype.getBugId = function getBugId () { - return util.getBugNo(this.doc.location.href); -}; - -/** * In case URL contains alias, not the real bug number, get the real bug no * from the XML representation. Sets correct value to this.bugNo. */ diff --git a/lib/util.js b/lib/util.js index 18a3c1b..0b1a79e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -61,7 +61,12 @@ var getParamsFromURL = exports.getParamsFromURL = function getParamsFromURL (url }; /** - * FIXME this should go to bzpage.js ... no reason to keep it here + * Get a bug no from URL ... fails with aliases + * It should theoretically belong to bzpage.js, but we don't have + * unit tests there yet, so keeping here. + * + * @param url String with URL to be analyzed + * @return String with the bug ID (hopefully number, but not for aliases) */ exports.getBugNo = function getBugNo(url) { var params = getParamsFromURL(url); diff --git a/tests/test-util.js b/tests/test-util.js index f420bb4..ee44a0d 100644 --- a/tests/test-util.js +++ b/tests/test-util.js @@ -209,4 +209,6 @@ exports.ensureGetParamsFromURL = function (test) { exports.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"); + test.assertEqual(bugNo, "serialWacom", "getting a bug alias; there is no guarantee of getting number!"); }; |