mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-30 17:27:44 +03:00
[submodule:extensions] Breaking change: rename module
to library
This commit is contained in:
@@ -28,7 +28,7 @@ expectType<IBrowser>(browser);
|
||||
expectType<string | undefined>(browser.name);
|
||||
expectType<string | undefined>(browser.version);
|
||||
expectType<string | undefined>(browser.major);
|
||||
expectType<'crawler' | 'cli' | 'email' | 'fetcher' | 'inapp' | 'mediaplayer' | 'module' | undefined>(browser.type);
|
||||
expectType<'crawler' | 'cli' | 'email' | 'fetcher' | 'inapp' | 'mediaplayer' | 'library' | undefined>(browser.type);
|
||||
expectType<boolean>(browser.is(''));
|
||||
expectType<string>(browser.toString());
|
||||
expectType<IBrowser | PromiseLike<IBrowser>>(browser.withClientHints());
|
||||
|
@@ -8,8 +8,8 @@ const clis = require('./specs/browser-clis.json');
|
||||
const crawlers = require('./specs/browser-crawlers.json');
|
||||
const emails = require('./specs/browser-emails.json');
|
||||
const fetchers = require('./specs/browser-fetchers.json');
|
||||
const modules = require('./specs/browser-modules.json');
|
||||
const { Bots, CLIs, Crawlers, Emails, Fetchers, Modules } = require('../src/extensions/ua-parser-extensions');
|
||||
const libraries = require('./specs/browser-libraries.json');
|
||||
const { Bots, CLIs, Crawlers, Emails, Fetchers, Libraries } = require('../src/extensions/ua-parser-extensions');
|
||||
|
||||
describe('Extensions', () => {
|
||||
[
|
||||
@@ -17,7 +17,7 @@ describe('Extensions', () => {
|
||||
['Crawlers', crawlers, Crawlers],
|
||||
['Emails', emails, Emails],
|
||||
['Fetchers', fetchers, Fetchers],
|
||||
['Modules', modules, Modules]
|
||||
['Libraries', libraries, Libraries]
|
||||
]
|
||||
.forEach((list) => {
|
||||
describe(list[0], () => {
|
||||
@@ -44,10 +44,10 @@ describe('Extensions', () => {
|
||||
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"});
|
||||
|
||||
const moduleParser = new UAParser(Modules);
|
||||
assert.deepEqual(moduleParser.setUA(axios).getBrowser(), {name: "axios", version: "1.3.5", major: "1", type: "module"});
|
||||
assert.deepEqual(moduleParser.setUA(jsdom).getBrowser(), {name: "jsdom", version: "20.0.3", major: "20", type: "module"});
|
||||
assert.deepEqual(moduleParser.setUA(scrapy).getBrowser(), {name: "Scrapy", version: "1.5.0", major: "1", type: "module"});
|
||||
const libraryParser = new UAParser(Libraries);
|
||||
assert.deepEqual(libraryParser.setUA(axios).getBrowser(), {name: "axios", version: "1.3.5", major: "1", type: "library"});
|
||||
assert.deepEqual(libraryParser.setUA(jsdom).getBrowser(), {name: "jsdom", version: "20.0.3", major: "20", type: "library"});
|
||||
assert.deepEqual(libraryParser.setUA(scrapy).getBrowser(), {name: "Scrapy", version: "1.5.0", major: "1", type: "library"});
|
||||
});
|
||||
|
||||
describe('Merge', () => {
|
||||
|
@@ -6,7 +6,7 @@
|
||||
{
|
||||
"name" : "Scrapy",
|
||||
"version" : "1.5.0",
|
||||
"type" : "module"
|
||||
"type" : "library"
|
||||
}
|
||||
}
|
||||
]
|
Reference in New Issue
Block a user