summaryrefslogtreecommitdiff
path: root/node_modules/ua-parser/js/test/old-api.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-10 10:38:44 +0200
committerMinteck <contact@minteck.org>2022-08-10 10:38:44 +0200
commitc6dbf0450566c40efc4a26f4f0717452b6ef95cd (patch)
treeb4be2d508223820d0a77d5a3e35e82684da3b6ec /node_modules/ua-parser/js/test/old-api.js
downloadhornchat-mane.tar.gz
hornchat-mane.tar.bz2
hornchat-mane.zip
Initial commitHEADmane
Diffstat (limited to 'node_modules/ua-parser/js/test/old-api.js')
-rw-r--r--node_modules/ua-parser/js/test/old-api.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/node_modules/ua-parser/js/test/old-api.js b/node_modules/ua-parser/js/test/old-api.js
new file mode 100644
index 0000000..7b9b6e2
--- /dev/null
+++ b/node_modules/ua-parser/js/test/old-api.js
@@ -0,0 +1,25 @@
+// Documenting current behaviour for backwards compat reqs.
+
+var assert = require('assert'),
+ parse = require('../index').parse;
+
+var USER_AGENT_STRING = 'Mozilla/5.0 (Windows NT 6.1; rv:2.0b6pre) Gecko/20100903 Firefox/4.0b6pre Firefox/4.0b6pre';
+
+suite('parse function', function() {
+ test('output with valid UA string', function() {
+ var output = parse(USER_AGENT_STRING);
+ assert.strictEqual(output.family, 'Firefox Beta');
+ assert.strictEqual(output.major, 4);
+ assert.strictEqual(output.minor, 0);
+ assert.ok(isNaN(output.patch));
+ });
+
+ test('output with invalid UA string', function() {
+ var output = parse('');
+ assert.strictEqual(output.family, 'Other');
+ assert.strictEqual(output.major, undefined);
+ assert.strictEqual(output.minor, undefined);
+ assert.strictEqual(output.patch, undefined);
+ });
+});
+