|
|
@ -1,6 +1,8 @@ |
|
|
|
var assert = require('assert') |
|
|
|
var assert = require('assert') |
|
|
|
var sinon = require('sinon') |
|
|
|
var sinon = require('sinon') |
|
|
|
const ethUtil = require('ethereumjs-util') |
|
|
|
const ethUtil = require('ethereumjs-util') |
|
|
|
|
|
|
|
GLOBAL.chrome = {} |
|
|
|
|
|
|
|
GLOBAL.browser = {} |
|
|
|
|
|
|
|
|
|
|
|
var path = require('path') |
|
|
|
var path = require('path') |
|
|
|
var Extension = require(path.join(__dirname, '..', '..', 'app', 'scripts', 'lib', 'extension-instance.js')) |
|
|
|
var Extension = require(path.join(__dirname, '..', '..', 'app', 'scripts', 'lib', 'extension-instance.js')) |
|
|
@ -11,7 +13,7 @@ describe('extension', function() { |
|
|
|
let extension |
|
|
|
let extension |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(function() { |
|
|
|
beforeEach(function() { |
|
|
|
window.chrome = { |
|
|
|
GLOBAL.chrome = { |
|
|
|
alarms: 'foo' |
|
|
|
alarms: 'foo' |
|
|
|
} |
|
|
|
} |
|
|
|
extension = new Extension() |
|
|
|
extension = new Extension() |
|
|
@ -24,13 +26,20 @@ describe('extension', function() { |
|
|
|
|
|
|
|
|
|
|
|
describe('without chrome global', function() { |
|
|
|
describe('without chrome global', function() { |
|
|
|
let extension |
|
|
|
let extension |
|
|
|
|
|
|
|
let realWindow |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(function() { |
|
|
|
beforeEach(function() { |
|
|
|
window.chrome = undefined |
|
|
|
realWindow = window |
|
|
|
window.alarms = 'foo' |
|
|
|
window = GLOBAL |
|
|
|
|
|
|
|
GLOBAL.chrome = undefined |
|
|
|
|
|
|
|
GLOBAL.alarms = 'foo' |
|
|
|
extension = new Extension() |
|
|
|
extension = new Extension() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
after(function() { |
|
|
|
|
|
|
|
window = realWindow |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should use the global apis', function() { |
|
|
|
it('should use the global apis', function() { |
|
|
|
assert.equal(extension.alarms, 'foo') |
|
|
|
assert.equal(extension.alarms, 'foo') |
|
|
|
}) |
|
|
|
}) |
|
|
|