@@ -9,6 +9,7 @@ import { ProjectFilesManager } from "../../../lib/common/services/project-files-
99import { EventEmitter } from "events" ;
1010import { PreviewAppFilesService } from "../../../lib/services/livesync/playground/preview-app-files-service" ;
1111import { WorkflowDataService , PreparePlatformData } from "../../../lib/services/workflow/workflow-data-service" ;
12+ import { INITIAL_SYNC_EVENT_NAME } from "../../../lib/constants" ;
1213
1314interface ITestCase {
1415 name : string ;
@@ -96,6 +97,13 @@ class LoggerMock extends LoggerStub {
9697 }
9798}
9899
100+ class PlatformWatcherServiceMock extends EventEmitter {
101+ public startWatchers ( platformData : IPlatformData , projectData : IProjectData , preparePlatformData : PreparePlatformData ) {
102+ isHMRPassedToEnv = preparePlatformData . env . hmr ;
103+ this . emit ( INITIAL_SYNC_EVENT_NAME , { } ) ;
104+ }
105+ }
106+
99107function createTestInjector ( options ?: {
100108 projectFiles ?: string [ ]
101109} ) {
@@ -157,12 +165,7 @@ function createTestInjector(options?: {
157165 injector . register ( "analyticsService" , {
158166 trackEventActionInGoogleAnalytics : ( ) => ( { } )
159167 } ) ;
160- injector . register ( "platformWatcherService" , {
161- startWatchers : ( platformData : IPlatformData , projectData : IProjectData , preparePlatformData : PreparePlatformData ) => {
162- isHMRPassedToEnv = preparePlatformData . env . hmr ;
163- } ,
164- on : ( ) => ( { } )
165- } ) ;
168+ injector . register ( "platformWatcherService" , PlatformWatcherServiceMock ) ;
166169 injector . register ( "workflowDataService" , WorkflowDataService ) ;
167170
168171 return injector ;
0 commit comments