File tree Expand file tree Collapse file tree 4 files changed +6
-29
lines changed
Expand file tree Collapse file tree 4 files changed +6
-29
lines changed Original file line number Diff line number Diff line change @@ -10,19 +10,19 @@ const { JSDOM } = require('jsdom');
1010
1111const HtmlFetcher = require ( './src/HtmlFetcher' ) ;
1212const HtmlParser = require ( './src/HtmlParser' ) ;
13- const Log = require ( './src/LoggerProxy' ) ;
1413
1514module . exports = NodeHelper . create ( {
1615 htmlFetcher : null ,
1716 htmlParser : null ,
1817
19- start : function ( htmlFetcher , htmlParser ) {
18+ start : function ( htmlFetcher , htmlParser , logger ) {
2019 this . htmlFetcher = htmlFetcher || new HtmlFetcher ( ) ;
2120 this . htmlParser = htmlParser || new HtmlParser ( JSDOM ) ;
21+ this . logger = logger || require ( 'logger' ) ;
2222 } ,
2323
2424 socketNotificationReceived : async function ( notification , payload ) {
25- Log . log ( `Received socket notification ${ notification } .` ) ;
25+ this . logger . log ( `Received socket notification ${ notification } .` ) ;
2626
2727 if ( notification === 'LOAD_EVENTS' ) {
2828 // Load data
@@ -34,7 +34,7 @@ module.exports = NodeHelper.create({
3434 } ,
3535
3636 loadEvents : async function ( language ) {
37- Log . log ( 'Load events ...' ) ;
37+ this . logger . log ( 'Load events ...' ) ;
3838
3939 // Get HTML
4040 const html = await this . htmlFetcher . fetch ( language ) ;
Original file line number Diff line number Diff line change 3737 "exclude" : [
3838 " coverage" ,
3939 " test" ,
40- " src/LoggerProxy.js" ,
4140 " src/WikiCssSelectors.js"
4241 ],
4342 "cache" : true ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -26,21 +26,19 @@ const htmlFetcherMock = {
2626 } ,
2727} ;
2828
29- // Mock proxy logger
30- const LoggerProxyFake = {
29+ const loggerMock = {
3130 log : function ( ) { } ,
3231} ;
3332
3433// Load helper definition
3534const nodeHelperDefinition = proxyquire ( '../../node_helper' , {
3635 node_helper : NodeHelperFake ,
37- './src/LoggerProxy' : LoggerProxyFake ,
3836} ) ;
3937
4038module . exports = function ( ) {
4139 const nodeHelper = Object . assign ( { } , nodeHelperDefinition ) ;
4240
43- nodeHelper . start ( htmlFetcherMock ) ;
41+ nodeHelper . start ( htmlFetcherMock , null , loggerMock ) ;
4442
4543 // Fake inherited methods
4644 nodeHelper . sendSocketNotification = sinon . fake ( ) ;
You can’t perform that action at this time.
0 commit comments