Total Complexity | 4 |
Complexity/F | 1 |
Lines of Code | 33 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | 'use strict'; |
||
2 | |||
3 | var _ = require('lodash'); |
||
4 | var expect = require('chai').expect; |
||
5 | var path = require('path'); |
||
6 | var sinon = require('sinon'); |
||
7 | |||
8 | var projectRoot = path.resolve(__dirname, '..', '..', '..', '..'); |
||
9 | |||
10 | describe('events', function () { |
||
11 | var runtime; |
||
12 | |||
13 | before(function () { |
||
14 | _.set(global, 'chrome.runtime', { |
||
15 | onMessage: { |
||
16 | addListener: sinon.spy() |
||
17 | } |
||
18 | }); |
||
19 | |||
20 | runtime = global.chrome.runtime; |
||
21 | }); |
||
22 | |||
23 | describe('initialization', function () { |
||
24 | it('should bind to message events', function () { |
||
25 | var initialCallCount = runtime.onMessage.addListener.callCount; |
||
26 | |||
27 | // eslint-disable-next-line |
||
28 | require(path.join(projectRoot, 'source', 'js', 'events')); |
||
29 | |||
30 | expect(runtime.onMessage.addListener.callCount).to.be.greaterThan(initialCallCount); |
||
31 | }); |
||
32 | }); |
||
33 | }); |
||
34 |