Refactor window wrapper for node testing

This commit is contained in:
Kyle Shockey
2017-03-22 21:09:36 -07:00
parent f195d01184
commit 78c67f9eb1

View File

@@ -1,3 +1,4 @@
function makeWindow() {
var win = {
location: {},
history: {},
@@ -5,6 +6,10 @@ var win = {
close: () => {}
}
if(typeof window === "undefined") {
return win
}
try {
win = window
var props = ["File", "Blob", "FormData"]
@@ -17,4 +22,7 @@ try {
console.error(e)
}
export default win
return win
}
module.exports = makeWindow()