UAS[ pf ][ bs ].forEach(function ( val ) { var _env = detect( val[ 0 ] ); var _browser = val[ 1 ].split( ',' ); var _os = val[ 2 ].length ? val[ 2 ].split( ',' ) : []; expect( _env.browser.version ).toEqual( _browser.pop() ); expect( _browser.every(function ( key ) { return _env.browser[ key ] === true; }) ).toEqual( true ); if ( _os.length ) { expect( _env.os.version ).toEqual( _os.pop() ); expect( _os.every(function ( key ) { return _env.os[ key ] === true; }) ).toEqual( true ); } });
it( 'should return correct.', function() { var env = detect( navigator.userAgent ); expect( typeof env ).toEqual( 'object' ); expect( typeof env.os ).toEqual( 'object' ); expect( typeof env.browser ).toEqual( 'object' ); });