aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/extension-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/extension-test.js')
-rw-r--r--test/unit/extension-test.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/unit/extension-test.js b/test/unit/extension-test.js
new file mode 100644
index 000000000..6b695e835
--- /dev/null
+++ b/test/unit/extension-test.js
@@ -0,0 +1,48 @@
+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'))
+
+describe('extension', function() {
+
+ describe('with chrome global', function() {
+ let extension
+
+ beforeEach(function() {
+ GLOBAL.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
+ let realWindow
+
+ beforeEach(function() {
+ 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')
+ })
+ })
+
+})