mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2026-01-16 08:27:12 +03:00
* feat(email): significantly expanded email client detection to support 40+ new user agents, including Alpine, Canary Mail, FairEmail, ProtonMail Bridge, Tutanota, and The Bat! feat(helpers): added getOutlookEdition() utility to interpret raw version strings into specific Outlook editions (e.g., distinguishing Outlook 2016 MSI vs. Click-to-Run/365). chore(enums): added comprehensive BrowserName.Email enums for all newly supported clients. chore(types): added TypeScript definitions for the new getOutlookEdition helper. test(email): added comprehensive test suite covering 60+ email client user agent strings. test(helpers): added unit tests for getOutlookEdition covering Windows (MSI/C2R) and Mac variants. * chore: Some small updates for business logic around K-9, Yahoo Mail, Outlook * test: Edgecase alignment and fixes chore(deps): npm vulnerability fix in package-lock.json chore: Updated dist builds * Revert accidentally-removed additional code and comments * Correct comment syntax in ua-parser-extensions.js Fix comment formatting and clean up code. * chore: build fix
39 lines
1.9 KiB
JavaScript
39 lines
1.9 KiB
JavaScript
const assert = require('assert');
|
|
const { isFrozenUA, getOutlookEdition } = require('../../../src/helpers/ua-parser-helpers');
|
|
|
|
describe('isFrozenUA()', () => {
|
|
it('matches supplied user-agent string with known frozen user-agent pattern', () => {
|
|
|
|
const regularMobileUA = "Mozilla/5.0 (Linux; Android 9; SM-A205U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.1234.56 Mobile Safari/537.36";
|
|
const frozenMobileUA = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.0.0 Mobile Safari/537.36";
|
|
|
|
assert.equal(isFrozenUA(regularMobileUA), false);
|
|
assert.equal(isFrozenUA(frozenMobileUA), true);
|
|
});
|
|
});
|
|
|
|
describe('getOutlookEdition()', () => {
|
|
it('identifies Windows versions correctly', () => {
|
|
// MSI Version (Older engine)
|
|
assert.equal(getOutlookEdition('Microsoft Outlook', '16.0.4266.1001'), 'Outlook 2016 (MSI / Volume License)');
|
|
// Click-to-Run (Modern engine)
|
|
assert.equal(getOutlookEdition('Microsoft Outlook', '16.0.14326.20000'), 'Outlook 365 / 2019+ (Modern)');
|
|
// Legacy Major Version
|
|
assert.equal(getOutlookEdition('Microsoft Outlook', '15.0.4569.1506'), 'Outlook 2013');
|
|
});
|
|
|
|
it('identifies Mac versions correctly', () => {
|
|
assert.equal(getOutlookEdition('MacOutlook', '16.61'), 'Outlook for Mac (Modern)');
|
|
assert.equal(getOutlookEdition('MacOutlook', '15.4'), 'Outlook for Mac (Legacy)');
|
|
});
|
|
|
|
it('returns original name for unknown inputs', () => {
|
|
assert.equal(getOutlookEdition('Thunderbird', '91.0'), 'Thunderbird');
|
|
});
|
|
|
|
it('handles New Outlook (OneOutlook) correctly', () => {
|
|
// New Outlook usually sends a browser UA, but if it sends "Outlook" without version info matches,
|
|
// it shouldn't trigger the Legacy/MSI logic.
|
|
assert.equal(getOutlookEdition('Microsoft Outlook', 'SomeRandomString'), 'Microsoft Outlook');
|
|
});
|
|
}); |