diff options
Diffstat (limited to 'test/unit/extension-test.js')
-rw-r--r-- | test/unit/extension-test.js | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/test/unit/extension-test.js b/test/unit/extension-test.js index 6b695e835..8f259f05c 100644 --- a/test/unit/extension-test.js +++ b/test/unit/extension-test.js @@ -1,19 +1,47 @@ var assert = require('assert') var sinon = require('sinon') const ethUtil = require('ethereumjs-util') -GLOBAL.chrome = {} -GLOBAL.browser = {} +global.chrome = {} +global.browser = {} var path = require('path') var Extension = require(path.join(__dirname, '..', '..', 'app', 'scripts', 'lib', 'extension-instance.js')) describe('extension', function() { + describe('extension.getURL', function() { + const desiredResult = 'http://the-desired-result.io' + + describe('in Chrome or Firefox', function() { + global.chrome.extension = { + getURL: () => desiredResult + } + + it('returns the desired result', function() { + const extension = new Extension() + const result = extension.extension.getURL() + assert.equal(result, desiredResult) + }) + }) + + describe('in Microsoft Edge', function() { + global.browser.extension = { + getURL: () => desiredResult + } + + it('returns the desired result', function() { + const extension = new Extension() + const result = extension.extension.getURL() + assert.equal(result, desiredResult) + }) + }) + }) + describe('with chrome global', function() { let extension beforeEach(function() { - GLOBAL.chrome = { + global.chrome = { alarms: 'foo' } extension = new Extension() @@ -30,9 +58,9 @@ describe('extension', function() { beforeEach(function() { realWindow = window - window = GLOBAL - GLOBAL.chrome = undefined - GLOBAL.alarms = 'foo' + window = global + global.chrome = undefined + global.alarms = 'foo' extension = new Extension() }) @@ -45,4 +73,5 @@ describe('extension', function() { }) }) + }) |