11 changed files with 13 additions and 12 deletions
@ -1,7 +1,7 @@ |
|||
import test from 'ava'; |
|||
import browserEnv from '../src'; |
|||
|
|||
test(t => { |
|||
test('Arguments should be able to be passed in either order', t => { |
|||
t.is(typeof navigator, 'undefined'); |
|||
browserEnv(['navigator'], { userAgent: 'first' }); |
|||
t.is(navigator.userAgent, 'first'); |
@ -1,9 +1,10 @@ |
|||
import test from 'ava'; |
|||
import browserEnv from '../src'; |
|||
|
|||
// We have to require() here as imports have to be top level so we can't set
|
|||
// globals first
|
|||
test(t => { |
|||
test('Existing falsy node globals don\'t get overwritten', t => { |
|||
global.document = false; |
|||
require('../src')(); |
|||
browserEnv(); |
|||
t.is(document, false); |
|||
}); |
@ -1,7 +1,7 @@ |
|||
import test from 'ava'; |
|||
import browserEnv from '../src'; |
|||
|
|||
test(t => { |
|||
test('Function should return window instance', t => { |
|||
const returnValue = browserEnv(); |
|||
t.is(returnValue, window); |
|||
}); |
|||
|
@ -1,6 +1,6 @@ |
|||
import test from 'ava'; |
|||
import browserEnv from '../src'; |
|||
|
|||
test(t => { |
|||
test('Function shouldn\'t return the same instance', t => { |
|||
t.not(browserEnv(), browserEnv()); |
|||
}); |
|||
|
Loading…
Reference in new issue