mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Add a spy to track calling Parser._parseBrowser when Parser.getBrowser called
This commit is contained in:
parent
ce885847ce
commit
b5aa54553f
@ -1,4 +1,5 @@
|
|||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
|
import sinon from 'sinon';
|
||||||
import Parser from '../../src/parser';
|
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 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';
|
||||||
@ -17,7 +18,9 @@ test('test', t => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('_parseBrowser', t => {
|
test('_parseBrowser', t => {
|
||||||
const b = parser._parseBrowser();
|
const spy = sinon.spy(parser, '_parseBrowser');
|
||||||
|
const b = parser.getBrowser();
|
||||||
|
t.truthy(spy.called);
|
||||||
t.is(b.name, 'Opera');
|
t.is(b.name, 'Opera');
|
||||||
t.is(b.version, '43.0.2442.1165');
|
t.is(b.version, '43.0.2442.1165');
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user