File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 44 */
55
66import { forEach } from 'lodash' ;
7- import sinon from 'sinon' ;
87import ChromeEvent from '../events/index' ;
98import BaseCache from './cache' ;
109
1110export default class EventsCache extends BaseCache {
1211
13- constructor ( ) {
12+ constructor ( sinon ) {
1413 super ( ) ;
1514 this . events = Object . create ( null ) ;
1615 this . sandbox = sinon . sandbox . create ( ) ;
Original file line number Diff line number Diff line change 44 */
55
66import { set , get , reduce , assign } from 'lodash' ;
7+ import sinon from 'sinon' ;
78import Stubs from './stub' ;
89import Events from './events' ;
910import Props from './props' ;
@@ -29,11 +30,12 @@ export default class Api {
2930 /**
3031 * @param {Array<Object> } config
3132 */
32- constructor ( config ) {
33+ constructor ( config , options = { } ) {
34+ this . sinon = options . sinon ? options . sinon : sinon ;
3335 this . NS_RULE = / ^ ( .+ ) \. ( .+ ) $ / ;
3436 this . config = config ;
35- this . stubs = new Stubs ( ) ;
36- this . events = new Events ( ) ;
37+ this . stubs = new Stubs ( this . sinon ) ;
38+ this . events = new Events ( this . sinon ) ;
3739 this . props = new Props ( ) ;
3840 this . manager = new Manager ( this . stubs , this . events , this . props ) ;
3941 }
Original file line number Diff line number Diff line change 33 * @overview Subs cache
44 */
55
6- import sinon from 'sinon' ;
76import BaseCache from './cache' ;
87
98export default class StubsCache extends BaseCache {
109
11- constructor ( ) {
10+ constructor ( sinon ) {
1211 super ( ) ;
1312 this . stubs = Object . create ( null ) ;
13+ this . sinon = sinon ;
1414 }
1515
1616 /**
@@ -42,7 +42,7 @@ export default class StubsCache extends BaseCache {
4242 * @returns {Function }
4343 */
4444 create ( key ) {
45- const stub = sinon . stub ( ) ;
45+ const stub = this . sinon . stub ( ) ;
4646 stub . flush = ( ) => {
4747 this . deleteStub ( key ) ;
4848 } ;
You can’t perform that action at this time.
0 commit comments