Fix #718 - Extension param now accept multiple extensions

This commit is contained in:
Faisal Salman
2024-06-06 20:02:22 +07:00
parent f7810dbfcf
commit 0a46ac396a
4 changed files with 32 additions and 10 deletions

View File

@@ -34,6 +34,12 @@ describe('Bots', () => {
assert.deepEqual(botsAndCLIsParser.setUA(wget).getBrowser(), {name: "Wget", version: "1.21.1", major: "1", type:"cli"});
assert.deepEqual(botsAndCLIsParser.setUA(facebookBot).getBrowser(), {name: "FacebookBot", version: "1.0", major: "1", type:"bot"});
// alternative merge options
const botsAndCLIsParser2 = new UAParser([Bots, CLIs]);
const botsAndCLIsParser3 = new UAParser(facebookBot, [Bots, CLIs]);
assert.deepEqual(botsAndCLIsParser2.setUA(wget).getBrowser(), {name: "Wget", version: "1.21.1", major: "1", type:"cli"});
assert.deepEqual(botsAndCLIsParser3.getBrowser(), {name: "FacebookBot", version: "1.0", major: "1", type:"bot"});
const emailParser = new UAParser(Emails);
assert.deepEqual(emailParser.setUA(outlook).getBrowser(), {name: "Microsoft Outlook", version: "16.0.9126", major: "16", type: "email"});
assert.deepEqual(emailParser.setUA(thunderbird).getBrowser(), {name: "Thunderbird", version: "78.13.0", major: "78", type: "email"});

View File

@@ -126,6 +126,13 @@ describe('Extending Regex', function () {
});
let myUA2 = 'Mozilla/5.0 MyTab 14 Pro Max';
assert.deepEqual(myParser2.setUA(myUA2).getDevice(), {vendor: "MyTab", model: "14 Pro Max", type: "tablet"});
let myParser3 = new UAParser([{
browser: myOwnListOfBrowsers
}, {
device: myOwnListOfDevices
}]);
assert.deepEqual(myParser3.setUA(myUA2).getDevice(), {vendor: "MyTab", model: "14 Pro Max", type: "tablet"});
});
describe('User-agent length', function () {