|
|
@ -1,8 +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.chrome = {} |
|
|
|
GLOBAL.browser = {} |
|
|
|
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')) |
|
|
@ -13,19 +13,21 @@ describe('extension', function() { |
|
|
|
const desiredResult = 'http://the-desired-result.io' |
|
|
|
const desiredResult = 'http://the-desired-result.io' |
|
|
|
|
|
|
|
|
|
|
|
describe('in Chrome or Firefox', function() { |
|
|
|
describe('in Chrome or Firefox', function() { |
|
|
|
GLOBAL.chrome.extension = { |
|
|
|
global.chrome.extension = { |
|
|
|
getURL: () => desiredResult |
|
|
|
getURL: () => desiredResult |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
it('returns the desired result', function() { |
|
|
|
it('returns the desired result', function() { |
|
|
|
|
|
|
|
console.dir(Extension) |
|
|
|
const extension = new Extension() |
|
|
|
const extension = new Extension() |
|
|
|
|
|
|
|
console.dir(extension) |
|
|
|
const result = extension.extension.getURL() |
|
|
|
const result = extension.extension.getURL() |
|
|
|
assert.equal(result, desiredResult) |
|
|
|
assert.equal(result, desiredResult) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
describe('in Microsoft Edge', function() { |
|
|
|
describe('in Microsoft Edge', function() { |
|
|
|
GLOBAL.browser.extension = { |
|
|
|
global.browser.extension = { |
|
|
|
getURL: () => desiredResult |
|
|
|
getURL: () => desiredResult |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -41,7 +43,7 @@ describe('extension', function() { |
|
|
|
let extension |
|
|
|
let extension |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(function() { |
|
|
|
beforeEach(function() { |
|
|
|
GLOBAL.chrome = { |
|
|
|
global.chrome = { |
|
|
|
alarms: 'foo' |
|
|
|
alarms: 'foo' |
|
|
|
} |
|
|
|
} |
|
|
|
extension = new Extension() |
|
|
|
extension = new Extension() |
|
|
@ -58,9 +60,9 @@ describe('extension', function() { |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(function() { |
|
|
|
beforeEach(function() { |
|
|
|
realWindow = window |
|
|
|
realWindow = window |
|
|
|
window = GLOBAL |
|
|
|
window = global |
|
|
|
GLOBAL.chrome = undefined |
|
|
|
global.chrome = undefined |
|
|
|
GLOBAL.alarms = 'foo' |
|
|
|
global.alarms = 'foo' |
|
|
|
extension = new Extension() |
|
|
|
extension = new Extension() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|