From 6658bea8d444281491718f8eee7bc3ae42f91b69 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 21 Jul 2016 10:45:32 -0700 Subject: Implement some cross-browser practices (#473) * Add mozilla plugin key to manifest * Move all chrome references into platform-checking module Addresses #453 * Add chrome global back to linter blacklist * Add tests --- test/unit/extension-test.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/unit/extension-test.js (limited to 'test') diff --git a/test/unit/extension-test.js b/test/unit/extension-test.js new file mode 100644 index 000000000..0a03a3b97 --- /dev/null +++ b/test/unit/extension-test.js @@ -0,0 +1,39 @@ +var assert = require('assert') +var sinon = require('sinon') +const ethUtil = require('ethereumjs-util') + +var path = require('path') +var Extension = require(path.join(__dirname, '..', '..', 'app', 'scripts', 'lib', 'extension-instance.js')) + +describe('extension', function() { + + describe('with chrome global', function() { + let extension + + beforeEach(function() { + window.chrome = { + alarms: 'foo' + } + extension = new Extension() + }) + + it('should use the chrome global apis', function() { + assert.equal(extension.alarms, 'foo') + }) + }) + + describe('without chrome global', function() { + let extension + + beforeEach(function() { + window.chrome = undefined + window.alarms = 'foo' + extension = new Extension() + }) + + it('should use the global apis', function() { + assert.equal(extension.alarms, 'foo') + }) + }) + +}) -- cgit v1.2.3