File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
redisinsight/api/src/modules/profiler/models Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -39,12 +39,13 @@ describe('LogFile', () => {
39
39
expect ( logFile . getWriteStream ( ) ) . toEqual ( stream ) ;
40
40
} ) ;
41
41
42
- it ( 'getReadStream' , ( ) => {
42
+ it ( 'getReadStream' , async ( ) => {
43
43
const stream = logFile . getReadStream ( ) ;
44
44
expect ( stream ) . toBeInstanceOf ( ReadStream ) ;
45
45
expect ( stream . destroyed ) . toEqual ( false ) ;
46
46
expect ( logFile . getReadStream ( ) ) . not . toEqual ( stream ) ;
47
47
stream . emit ( 'end' ) ;
48
+ await new Promise ( ( r ) => setTimeout ( r , 500 ) ) ;
48
49
expect ( stream . destroyed ) . toEqual ( true ) ;
49
50
expect ( mockProfilerAnalyticsEvents . get ( TelemetryEvents . ProfilerLogDownloaded ) ) . toHaveBeenCalled ( ) ;
50
51
} ) ;
@@ -96,6 +97,7 @@ describe('LogFile', () => {
96
97
const stream = logFile . getWriteStream ( ) ;
97
98
expect ( stream [ '_writableState' ] . ended ) . toEqual ( false ) ;
98
99
stream . write ( 'somedata' ) ;
100
+ await new Promise ( ( r ) => setTimeout ( r , 500 ) ) ;
99
101
expect ( fs . existsSync ( logFile [ 'filePath' ] ) ) . toEqual ( true ) ;
100
102
expect ( logFile [ 'writeStream' ] ) . toEqual ( stream ) ;
101
103
await logFile . destroy ( ) ;
You can’t perform that action at this time.
0 commit comments