1
0
mirror of https://github.com/lancedikson/bowser synced 2024-09-27 22:03:37 +00:00
lancedikson_bowser/test/unit/utils.js

16 lines
398 B
JavaScript
Raw Normal View History

2017-04-09 14:13:00 +00:00
import test from 'ava';
2018-06-30 16:40:10 +00:00
import {
getFirstMatch,
getWindowsVersionName,
} from '../../src/utils';
2017-04-09 14:13:00 +00:00
2018-06-27 20:09:45 +00:00
test('getFirstMatch', (t) => {
2017-04-09 14:13:00 +00:00
const matchedVersion = getFirstMatch(/version\/(\S+)/i, 'Chrome Version/11.11.11');
t.is(matchedVersion, '11.11.11');
});
2018-06-30 16:40:10 +00:00
test('getWindowsVersionName', (t) => {
t.is(getWindowsVersionName('NT 5.0'), '2000');
t.is(getWindowsVersionName('XXX'), void 0);
});