1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00
lancedikson_bowser/test/acceptance/test-list-of-ua.js

22 lines
723 B
JavaScript
Raw Permalink Normal View History

import test from 'ava';
import yaml from 'yamljs';
import path from 'path';
2018-06-27 19:52:43 +00:00
import Bowser from '../../src/bowser';
2018-09-15 11:31:39 +00:00
import BowserBuild from '../../es5';
const listOfUA = yaml.load(path.join(__dirname, 'useragentstrings.yml'));
2018-06-27 20:09:45 +00:00
const browserNames = Object.keys(listOfUA);
browserNames.forEach((browserName) => {
2019-01-19 10:07:15 +00:00
listOfUA[browserName].forEach((browser, index) => {
test(`Test ${browserName} ${index}`, (t) => {
2018-07-05 19:58:14 +00:00
const parsed = Bowser.parse(browser.ua);
2018-09-15 11:31:39 +00:00
const parsedBuild = BowserBuild.parse(browser.ua);
t.deepEqual(parsed, browser.spec, `${browser.ua}`);
2018-09-15 11:31:39 +00:00
t.deepEqual(parsedBuild, browser.spec, `${browser.ua}`);
t.is(parsed.browser.name, browserName, `${browser.ua}`);
});
});
2018-06-27 20:09:45 +00:00
});