2017-08-20 15:21:17 +00:00
|
|
|
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';
|
2017-08-20 15:21:17 +00:00
|
|
|
|
|
|
|
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) => {
|
2017-10-17 18:55:45 +00:00
|
|
|
listOfUA[browserName].forEach((browser) => {
|
2018-06-27 19:52:43 +00:00
|
|
|
test('Check all the test browsers', (t) => {
|
2018-07-05 19:58:14 +00:00
|
|
|
const parsed = Bowser.parse(browser.ua);
|
2017-08-20 15:21:17 +00:00
|
|
|
t.deepEqual(parsed, browser.spec, `${browser.ua}`);
|
|
|
|
t.is(parsed.browser.name, browserName, `${browser.ua}`);
|
|
|
|
});
|
2017-10-17 18:55:45 +00:00
|
|
|
});
|
2018-06-27 20:09:45 +00:00
|
|
|
});
|