Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 627FBE0112C; Thu, 8 Oct 2015 11:32:48 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.212.182 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id DB896E010D2 for ; Thu, 8 Oct 2015 11:32:45 -0700 (PDT) Received: by wicgb1 with SMTP id gb1so37809482wic.1 for ; Thu, 08 Oct 2015 11:32:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QfiqMXYKqW8sdSgp/3EzoAgcC4xBILE+Oh7DpJQUfhQ=; b=Jv9SQwXaPCyRNmAFpI3iby4znMusoDMlVTeiky1igbqmzDg6EpUUCVvVNAOJSCI0Of Dj4oSJNJRKs7n/TsN7iv1sUcuLojkUjufrEmb5wAdwI4j6nC9tvrfL4z5J3DR0oixPt2 naHzrxOgbbKFR/NERecYdEWE0idATKiUyR09Gu6ygHPZrFCjx1QixxhgjSoASuubaYgk 7TLzRaFEPmK3PL12LQFLpXhdIuwypIhkFlkTEhxcOObVgRqhof4nZz+ZJ2SdtduDzZJp y2MmXYA3CE+1BlZ8FzjaUCeerkCXZFdmz42ewJmBErqq92BmtlYWjSBzn7mC5t5Qb6sb MPog== X-Gm-Message-State: ALoCoQkUYewcxaIw75r3y9RwnHElb38EzIDS5GRzcnk16ITn5LvcVVqpt+XQkV2L/piPYbBROJTH X-Received: by 10.194.103.130 with SMTP id fw2mr10777161wjb.121.1444329164863; Thu, 08 Oct 2015 11:32:44 -0700 (PDT) Received: from dorado.Home ([2.218.205.118]) by smtp.gmail.com with ESMTPSA id x9sm47729394wjf.44.2015.10.08.11.32.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Oct 2015 11:32:44 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Thu, 8 Oct 2015 19:32:37 +0100 Message-Id: <1444329157-11590-6-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1444329157-11590-1-git-send-email-michael.g.wood@intel.com> References: <1444329157-11590-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 5/5] toaster: Update JS unit tests X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Oct 2015 18:32:48 -0000 Update JS unit tests. - Expand the add remove layer check to make sure that the layer is actually added to the project. - Remove some unused vars - Make sure that the layers/project ids will always exist at the point of running the test. - Add the missing typeahead input fields to the dom to fix the failing typeahead test. Signed-off-by: Michael Wood --- .../lib/toaster/toastergui/static/js/tests/test.js | 32 +++++++++++----------- .../toastergui/templates/js-unit-tests.html | 16 ++++++++--- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/js/tests/test.js b/bitbake/lib/toaster/toastergui/static/js/tests/test.js index f0df6e4..aac0ba6 100644 --- a/bitbake/lib/toaster/toastergui/static/js/tests/test.js +++ b/bitbake/lib/toaster/toastergui/static/js/tests/test.js @@ -13,8 +13,6 @@ QUnit.test("Layer alert notification", function(assert) { "name":"meta-example" }; - var correctResponse = "You have added 3 layers to your project: meta-example and its dependencies meta-example-two, meta-example-three"; - var layerDepsList = [ { "layerdetailurl":"/toastergui/project/1/layer/9", @@ -68,9 +66,9 @@ QUnit.test("Show notification", function(assert){ }); var layer = { - "id": 91, - "name": "meta-crystalforest", - "layerdetailurl": "/toastergui/project/4/layer/91" + "id": 1, + "name": "meta-testing", + "layerdetailurl": "/toastergui/project/1/layer/1" }; QUnit.test("Add layer", function(assert){ @@ -84,11 +82,19 @@ QUnit.test("Add layer", function(assert){ } }, 200); - libtoaster.addRmLayer(layer, true, function(deps){ - assert.equal(deps.length, 1); - done(); + /* Compare the number of layers before and after the add in the project */ + libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, function(prjInfo){ + var origNumLayers = prjInfo.layers.length; + + libtoaster.addRmLayer(layer, true, function(deps){ + libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, + function(prjInfo){ + assert.ok(prjInfo.layers.length > origNumLayers, + "Layer not added to project"); + done(); + }); + }); }); - }); QUnit.test("Rm layer", function(assert){ @@ -156,7 +162,7 @@ QUnit.test("Layer btns init", function(assert){ }); QUnit.test("Table init", function(assert){ - assert.throws(tableInit({ url : tableUrl })); + assert.throws(tableInit({ url : ctx.tableUrl })); }); $(document).ajaxError(function(event, jqxhr, settings, errMsg){ @@ -167,9 +173,3 @@ $(document).ajaxError(function(event, jqxhr, settings, errMsg){ assert.notOk(jqxhr.responseText); }); }); - - - - - - diff --git a/bitbake/lib/toaster/toastergui/templates/js-unit-tests.html b/bitbake/lib/toaster/toastergui/templates/js-unit-tests.html index 5b8fd84..8d65f33 100644 --- a/bitbake/lib/toaster/toastergui/templates/js-unit-tests.html +++ b/bitbake/lib/toaster/toastergui/templates/js-unit-tests.html @@ -22,9 +22,11 @@ -
@@ -34,6 +36,12 @@ -{% endblock %} - + + + + + + + +{% endblock %} -- 2.1.4