Browse Source

Add tests

pull/2/head
Luke Childs 9 years ago
parent
commit
270121c9b5
  1. 5
      package.json
  2. 14
      test/unit.js

5
package.json

@ -4,7 +4,7 @@
"description": "Simulates a global browser environment using jsdom", "description": "Simulates a global browser environment using jsdom",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "ava test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -25,5 +25,8 @@
"homepage": "https://github.com/lukechilds/node-browser-environment#readme", "homepage": "https://github.com/lukechilds/node-browser-environment#readme",
"dependencies": { "dependencies": {
"jsdom": "^9.2.0" "jsdom": "^9.2.0"
},
"devDependencies": {
"ava": "^0.14.0"
} }
} }

14
test/unit.js

@ -0,0 +1,14 @@
import test from 'ava';
import browserEnv from '../src';
test('Function should setup browser environment', t => {
t.is(typeof window, 'undefined');
t.is(typeof document, 'undefined');
t.is(typeof navigator, 'undefined');
t.is(typeof HTMLElement, 'undefined');
browserEnv();
t.not(typeof window, 'undefined');
t.not(typeof document, 'undefined');
t.not(typeof navigator, 'undefined');
t.not(typeof HTMLElement, 'undefined');
});
Loading…
Cancel
Save