Comparing version 0.3.1 to 0.3.2
@@ -6,3 +6,3 @@ var UNDEF = void 0; | ||
this.string = ua_str; | ||
this.userAgent = ua; | ||
this.userAgent = this.ua = ua; | ||
this.os = os; | ||
@@ -9,0 +9,0 @@ this.device = device |
@@ -14,3 +14,7 @@ var assert = require('assert'), | ||
['firefox_user_agent_strings.yaml', 'test_user_agent_parser.yaml'].forEach(function(fileName) { | ||
function msg(name, actual, expected) { | ||
return "Expected " + name + " to be " + JSON.stringify(expected) + " got " + JSON.stringify(actual) + " instead."; | ||
} | ||
['firefox_user_agent_strings.yaml', 'test_user_agent_parser.yaml', 'pgts_browser_list.yaml'].forEach(function(fileName) { | ||
var fixtures = readYAML(fileName).test_cases; | ||
@@ -21,8 +25,8 @@ suite(fileName, function() { | ||
test(f.user_agent_string, function() { | ||
var r = uaParser.parse(f.user_agent_string); | ||
var ua = uaParser.parse(f.user_agent_string).userAgent; | ||
fixFixture(f, ['major', 'minor', 'patch']); | ||
assert.strictEqual(r.userAgent.family, f.family); | ||
assert.strictEqual(r.userAgent.major, f.major); | ||
assert.strictEqual(r.userAgent.minor, f.minor); | ||
assert.strictEqual(r.userAgent.patch, f.patch); | ||
assert.strictEqual(ua.family, f.family, msg('ua.family', ua.family, f.family)); | ||
assert.strictEqual(ua.major, f.major, msg('ua.major', ua.major, f.major)); | ||
assert.strictEqual(ua.minor, f.minor, msg('ua.minor', ua.minor, f.minor)); | ||
assert.strictEqual(ua.patch, f.patch, msg('ua.patch', ua.patch, f.patch)); | ||
}); | ||
@@ -38,9 +42,9 @@ }); | ||
test(f.user_agent_string, function() { | ||
var r = uaParser.parse(f.user_agent_string); | ||
var os = uaParser.parse(f.user_agent_string).os; | ||
fixFixture(f, ['major', 'minor', 'patch', 'patch_minor']); | ||
assert.strictEqual(r.os.family, f.family); | ||
assert.strictEqual(r.os.major, f.major); | ||
assert.strictEqual(r.os.minor, f.minor); | ||
assert.strictEqual(r.os.patch, f.patch); | ||
assert.strictEqual(r.os.patchMinor, f.patch_minor); | ||
assert.strictEqual(os.family, f.family, msg('os.family', os.family, f.family)); | ||
assert.strictEqual(os.major, f.major, msg('os.major', os.major, f.major)); | ||
assert.strictEqual(os.minor, f.minor, msg('os.minor', os.minor, f.minor)); | ||
assert.strictEqual(os.patch, f.patch, msg('os.patch', os.patch, f.patch)); | ||
assert.strictEqual(os.patchMinor, f.patch_minor, msg('os.patchMinor', os.patchMinor, f.patch_minor)); | ||
}); | ||
@@ -56,4 +60,4 @@ }); | ||
test(f.user_agent_string, function() { | ||
var r = uaParser.parse(f.user_agent_string); | ||
assert.strictEqual(r.device.family, f.family); | ||
var device = uaParser.parse(f.user_agent_string).device; | ||
assert.strictEqual(device.family, f.family, msg('device.family', device.family, f.family)); | ||
}); | ||
@@ -60,0 +64,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"main": "./js/index", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"maintainers": [ | ||
@@ -8,0 +8,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12128116
48
11590
337
4