From 676844156f0e8004b1c9b52aaff904eb55f43493 Mon Sep 17 00:00:00 2001 From: Sandro Sonntag Date: Fri, 30 May 2014 14:19:54 +0200 Subject: [PATCH] Testing bug - only the last definition of test case was checked --- test/browser-test.json | 6 +++--- test/test.js | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/browser-test.json b/test/browser-test.json index 4a88283..2e1e84b 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -14,7 +14,7 @@ "ua" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB5; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", "expect" : { - "name" : "Avant Browser", + "name" : "Avant ", "version" : "undefined", "major" : "undefined" } @@ -24,7 +24,7 @@ "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)", "expect" : { - "name" : "baidubrowser", + "name" : "baidu", "version" : "1.x", "major" : "1" } @@ -594,7 +594,7 @@ "ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SlimBrowser)", "expect" : { - "name" : "SlimBrowser", + "name" : "Slim", "version" : "undefined", "major" : "undefined" } diff --git a/test/test.js b/test/test.js index 978f4f0..55af014 100644 --- a/test/test.js +++ b/test/test.js @@ -53,13 +53,15 @@ for (var i in methods) { var result = parser.setUA(methods[i]['list'][j].ua).getResult()[methods[i]['label']]; for (var k in methods[i]['properties']) { var m = methods[i]['properties'][k]; - it('should return ' + methods[i]['label'] + ' ' + m + ': ' + expect[m], function () { - assert.equal(result[m], expect[m] != 'undefined' ? expect[m] : undefined); - }); + (function(result, expected) { + it('should return ' + methods[i]['label'] + ' ' + m + ': ' + expect[m], function () { + assert.equal(result, expected); + }); + })(result[m], expect[m] != 'undefined' ? expect[m] : undefined); } }); }); } } }); -} +} \ No newline at end of file