mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Fix tests after changes
This commit is contained in:
parent
1f572ed8f4
commit
c79b71736e
@ -40,7 +40,7 @@ class Bowser {
|
||||
* @return {ParsedResult}
|
||||
*/
|
||||
static parse(UA) {
|
||||
return (new Bowser(UA)).getResult();
|
||||
return (new Parser(UA)).getResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,7 @@ class Utils {
|
||||
* @return {Number} comparison result: -1 when versionA is lower,
|
||||
* 1 when versionA is bigger, 0 when both equal
|
||||
*/
|
||||
/* eslint consistent-return: 1 */
|
||||
static compareVersions(versionA, versionB) {
|
||||
// 1) get common precision for both versions, for example for "10.0" and "9" it should be 2
|
||||
let precision = Math.max(
|
||||
|
@ -10,7 +10,7 @@ const browserNames = Object.keys(listOfUA);
|
||||
browserNames.forEach((browserName) => {
|
||||
listOfUA[browserName].forEach((browser) => {
|
||||
test('Check all the test browsers', (t) => {
|
||||
const parsed = new Bowser(browser.ua).parse().getResult();
|
||||
const parsed = Bowser.parse(browser.ua);
|
||||
t.deepEqual(parsed, browser.spec, `${browser.ua}`);
|
||||
t.is(parsed.browser.name, browserName, `${browser.ua}`);
|
||||
});
|
||||
|
@ -3,14 +3,14 @@ import Bowser from '../../src/bowser';
|
||||
import Parser from '../../src/parser';
|
||||
|
||||
const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.1165';
|
||||
const browser = new Bowser(UA);
|
||||
const browser = Bowser.getParser(UA);
|
||||
|
||||
test('Bowser`s constructor returns a Parser instance', (t) => {
|
||||
t.truthy(browser instanceof Parser);
|
||||
});
|
||||
|
||||
test('Bowser`s constructor fails if UA is empty', (t) => {
|
||||
t.throws(() => (new Bowser()));
|
||||
t.throws(() => (Bowser.getParser()));
|
||||
});
|
||||
|
||||
test('Bowser.parse parses UA and returns result', (t) => {
|
||||
|
Loading…
Reference in New Issue
Block a user