aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-07-26 09:37:10 +0800
committerGitHub <noreply@github.com>2016-07-26 09:37:10 +0800
commit04f755a132e80fc018e42e2104f6c6feffeb183f (patch)
treec3f1e7a428cff016caa214712d49dead45ebf335 /test
parent11dfb8e869d425204512b250b00ef71ed85a14cc (diff)
parent0eb7354c1acc036452115351485d0fbc94b4bb08 (diff)
downloadtangerine-wallet-browser-04f755a132e80fc018e42e2104f6c6feffeb183f.tar.gz
tangerine-wallet-browser-04f755a132e80fc018e42e2104f6c6feffeb183f.tar.zst
tangerine-wallet-browser-04f755a132e80fc018e42e2104f6c6feffeb183f.zip
Merge pull request #482 from MetaMask/FirefoxCompatibility
Fix inpage script race condition
Diffstat (limited to 'test')
-rw-r--r--test/unit/extension-test.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/unit/extension-test.js b/test/unit/extension-test.js
index 0a03a3b97..6b695e835 100644
--- a/test/unit/extension-test.js
+++ b/test/unit/extension-test.js
@@ -1,6 +1,8 @@
var assert = require('assert')
var sinon = require('sinon')
const ethUtil = require('ethereumjs-util')
+GLOBAL.chrome = {}
+GLOBAL.browser = {}
var path = require('path')
var Extension = require(path.join(__dirname, '..', '..', 'app', 'scripts', 'lib', 'extension-instance.js'))
@@ -11,7 +13,7 @@ describe('extension', function() {
let extension
beforeEach(function() {
- window.chrome = {
+ GLOBAL.chrome = {
alarms: 'foo'
}
extension = new Extension()
@@ -24,13 +26,20 @@ describe('extension', function() {
describe('without chrome global', function() {
let extension
+ let realWindow
beforeEach(function() {
- window.chrome = undefined
- window.alarms = 'foo'
+ realWindow = window
+ window = GLOBAL
+ GLOBAL.chrome = undefined
+ GLOBAL.alarms = 'foo'
extension = new Extension()
})
+ after(function() {
+ window = realWindow
+ })
+
it('should use the global apis', function() {
assert.equal(extension.alarms, 'foo')
})