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)",
"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"
}

View File

@ -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);
}
});
});
}
}
});
}
}