Testing bug - only the last definition of test case was checked

This commit is contained in:
Sandro Sonntag 2014-05-30 14:19:54 +02:00
parent 7234216e02
commit 676844156f
2 changed files with 9 additions and 7 deletions

View File

@ -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)", "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" : "expect" :
{ {
"name" : "Avant Browser", "name" : "Avant ",
"version" : "undefined", "version" : "undefined",
"major" : "undefined" "major" : "undefined"
} }
@ -24,7 +24,7 @@
"ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)", "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)",
"expect" : "expect" :
{ {
"name" : "baidubrowser", "name" : "baidu",
"version" : "1.x", "version" : "1.x",
"major" : "1" "major" : "1"
} }
@ -594,7 +594,7 @@
"ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SlimBrowser)", "ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SlimBrowser)",
"expect" : "expect" :
{ {
"name" : "SlimBrowser", "name" : "Slim",
"version" : "undefined", "version" : "undefined",
"major" : "undefined" "major" : "undefined"
} }

View File

@ -53,9 +53,11 @@ for (var i in methods) {
var result = parser.setUA(methods[i]['list'][j].ua).getResult()[methods[i]['label']]; var result = parser.setUA(methods[i]['list'][j].ua).getResult()[methods[i]['label']];
for (var k in methods[i]['properties']) { for (var k in methods[i]['properties']) {
var m = methods[i]['properties'][k]; var m = methods[i]['properties'][k];
(function(result, expected) {
it('should return ' + methods[i]['label'] + ' ' + m + ': ' + expect[m], function () { it('should return ' + methods[i]['label'] + ' ' + m + ': ' + expect[m], function () {
assert.equal(result[m], expect[m] != 'undefined' ? expect[m] : undefined); assert.equal(result, expected);
}); });
})(result[m], expect[m] != 'undefined' ? expect[m] : undefined);
} }
}); });
}); });