effects-as-data
Advanced tools
Comparing version 3.0.16 to 3.0.17
"use strict"; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
@@ -61,3 +59,3 @@ | ||
// istanbul ignore next | ||
var g = (typeof window === "undefined" ? "undefined" : _typeof(window)) === undefined ? global : window; | ||
var g = typeof window === "undefined" ? global : window; | ||
return g[name]; | ||
@@ -64,0 +62,0 @@ } |
@@ -180,6 +180,15 @@ "use strict"; | ||
test("globalVariable() should use window if available", function () { | ||
window.foo = "bar"; | ||
var value = globalVariable({ name: "foo" }); | ||
assert.equal(value, "bar"); | ||
global.window = { | ||
foo: "bar window" | ||
}; | ||
var value = globalVariable(coreCmds.globalVariable("foo")); | ||
global.window = undefined; | ||
assert.equal(value, "bar window"); | ||
}); | ||
test("globalVariable() should global if window is not available ", function () { | ||
global.foo = "bar global"; | ||
var value = globalVariable(coreCmds.globalVariable("foo")); | ||
assert.equal(value, "bar global"); | ||
}); | ||
//# sourceMappingURL=interpreters.spec.js.map |
{ | ||
"name": "effects-as-data", | ||
"version": "3.0.16", | ||
"version": "3.0.17", | ||
"description": | ||
@@ -35,2 +35,3 @@ "A micro abstraction layer for Javascript that makes writing, testing, and monitoring side-effects easy.", | ||
"jest": { | ||
"testEnvironment": "node", | ||
"testPathIgnorePatterns": [ | ||
@@ -37,0 +38,0 @@ "<rootDir>/test.js", |
@@ -39,3 +39,3 @@ const { delay } = require("./util"); | ||
// istanbul ignore next | ||
const g = typeof window === undefined ? global : window; | ||
const g = typeof window === "undefined" ? global : window; | ||
return g[name]; | ||
@@ -42,0 +42,0 @@ } |
@@ -112,5 +112,14 @@ const assert = require("assert"); | ||
test("globalVariable() should use window if available", () => { | ||
window.foo = "bar"; | ||
const value = globalVariable({ name: "foo" }); | ||
assert.equal(value, "bar"); | ||
global.window = { | ||
foo: "bar window" | ||
}; | ||
const value = globalVariable(coreCmds.globalVariable("foo")); | ||
global.window = undefined; | ||
assert.equal(value, "bar window"); | ||
}); | ||
test("globalVariable() should global if window is not available ", () => { | ||
global.foo = "bar global"; | ||
const value = globalVariable(coreCmds.globalVariable("foo")); | ||
assert.equal(value, "bar global"); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
693204
9066