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