1
0
mirror of https://github.com/lancedikson/bowser synced 2026-03-02 03:40:27 +00:00

Add constant output so that users can quickly get all types

This commit is contained in:
王涛
2019-05-20 15:33:10 +08:00
parent f567ab3ec2
commit fbc32e6736
8 changed files with 146 additions and 52 deletions

View File

@@ -1,6 +1,7 @@
import test from 'ava';
import sinon from 'sinon';
import Parser from '../../src/parser';
import Bowser from '../../src/bowser';
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 parser = new Parser(UA, true);
@@ -164,6 +165,12 @@ test('Parser.is should pass', (t) => {
t.is(parser.is('macos'), true);
});
test('Parser.is using constants should pass', (t) => {
t.is(parser.is(Bowser.BROWSER_MAP.opera), true);
t.is(parser.is(Bowser.PLATFORMS_MAP.desktop), true);
t.is(parser.is(Bowser.OS_MAP.MacOS), true);
});
test('Parser.some should pass', (t) => {
t.is(parser.some(['opera', 'chrome', 'firefox']), true);
t.is(parser.some(['macos', 'windows']), true);