aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/extension-test.js
blob: 0a03a3b97312d58a4f39e0323f53904aef769688 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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')
    })
  })

})