1
0
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:
Denis Demchenko 2017-04-09 22:36:03 +03:00
parent ce885847ce
commit b5aa54553f

View File

@ -1,4 +1,5 @@
import test from 'ava';
import sinon from 'sinon';
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';
@ -17,7 +18,9 @@ test('test', 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.version, '43.0.2442.1165');
});