@@ -12,7 +12,7 @@ const MOCK_MOVIE_ENDING_DATA = 0xfe
12
12
// We want to simulate the beginning and end of a movie, as well
13
13
// as non-movie packets.
14
14
const MOCK_MOVIE = [ MessageType . SDP , MessageType . ISOM , MessageType . ISOM ] . map (
15
- type => {
15
+ ( type ) => {
16
16
return { type, data : Buffer . allocUnsafe ( 1 ) . fill ( MOCK_MOVIE_DATA ) }
17
17
} ,
18
18
)
@@ -23,11 +23,11 @@ const MOCK_MOVIE_ENDING = [
23
23
MessageType . ISOM ,
24
24
MessageType . ISOM ,
25
25
MessageType . ISOM ,
26
- ] . map ( type => {
26
+ ] . map ( ( type ) => {
27
27
return { type, data : Buffer . allocUnsafe ( 1 ) . fill ( MOCK_MOVIE_ENDING_DATA ) }
28
28
} )
29
29
30
- const MOCK_NOT_MOVIE = [ '' , '' ] . map ( type => {
30
+ const MOCK_NOT_MOVIE = [ '' , '' ] . map ( ( type ) => {
31
31
return {
32
32
type : ( type as unknown ) as MessageType , // Intentionally bad type for testing
33
33
data : Buffer . allocUnsafe ( 1 ) . fill ( 0 ) ,
@@ -36,8 +36,8 @@ const MOCK_NOT_MOVIE = ['', ''].map(type => {
36
36
37
37
const copySpies = ( type : MessageType , messages : GenericMessage [ ] ) => {
38
38
return messages
39
- . filter ( msg => msg . type === type )
40
- . map ( msg => jest . spyOn ( msg . data , 'copy' ) )
39
+ . filter ( ( msg ) => msg . type === type )
40
+ . map ( ( msg ) => jest . spyOn ( msg . data , 'copy' ) )
41
41
}
42
42
43
43
/**
@@ -69,7 +69,7 @@ describe('it should follow standard component rules', () => {
69
69
} )
70
70
71
71
describe ( 'data copying' , ( ) => {
72
- test ( 'should not occur when capture inactive' , done => {
72
+ test ( 'should not occur when capture inactive' , ( done ) => {
73
73
const pipeline = pipelineFactory ( MOCK_MOVIE )
74
74
75
75
// Spy on the copy method of the underlying movie data.
@@ -79,13 +79,13 @@ describe('data copying', () => {
79
79
pipeline . flow ( )
80
80
81
81
pipeline . sink . incoming . on ( 'finish' , ( ) => {
82
- shouldNotCopy . forEach ( copy => expect ( copy ) . not . toHaveBeenCalled ( ) )
82
+ shouldNotCopy . forEach ( ( copy ) => expect ( copy ) . not . toHaveBeenCalled ( ) )
83
83
expect ( pipeline . sinkHandler . mock . calls . length ) . toBe ( MOCK_MOVIE . length )
84
84
done ( )
85
85
} )
86
86
} )
87
87
88
- test ( 'should occur when capture active' , done => {
88
+ test ( 'should occur when capture active' , ( done ) => {
89
89
const pipeline = pipelineFactory ( MOCK_MOVIE )
90
90
91
91
// Spy on the copy method of the underlying movie data.
@@ -99,13 +99,13 @@ describe('data copying', () => {
99
99
pipeline . flow ( )
100
100
101
101
pipeline . sink . incoming . on ( 'finish' , ( ) => {
102
- shouldCopy . forEach ( copy => expect ( copy ) . toHaveBeenCalled ( ) )
102
+ shouldCopy . forEach ( ( copy ) => expect ( copy ) . toHaveBeenCalled ( ) )
103
103
expect ( captureHandler ) . toHaveBeenCalledWith ( MOCK_MOVIE_BUFFER )
104
104
done ( )
105
105
} )
106
106
} )
107
107
108
- test ( 'should only occur when new movie has started' , done => {
108
+ test ( 'should only occur when new movie has started' , ( done ) => {
109
109
const pipeline = pipelineFactory ( MOCK_MOVIE_ENDING , MOCK_MOVIE )
110
110
111
111
const shouldNotCopy = copySpies ( MessageType . ISOM , MOCK_MOVIE_ENDING )
@@ -119,14 +119,14 @@ describe('data copying', () => {
119
119
pipeline . flow ( )
120
120
121
121
pipeline . sink . incoming . on ( 'finish' , ( ) => {
122
- shouldNotCopy . forEach ( copy => expect ( copy ) . not . toHaveBeenCalled ( ) )
123
- shouldCopy . forEach ( copy => expect ( copy ) . toHaveBeenCalled ( ) )
122
+ shouldNotCopy . forEach ( ( copy ) => expect ( copy ) . not . toHaveBeenCalled ( ) )
123
+ shouldCopy . forEach ( ( copy ) => expect ( copy ) . toHaveBeenCalled ( ) )
124
124
expect ( captureHandler ) . toHaveBeenCalledWith ( MOCK_MOVIE_BUFFER )
125
125
done ( )
126
126
} )
127
127
} )
128
128
129
- test ( 'should not occur when not a movie' , done => {
129
+ test ( 'should not occur when not a movie' , ( done ) => {
130
130
const pipeline = pipelineFactory ( MOCK_MOVIE , MOCK_NOT_MOVIE )
131
131
132
132
const shouldCopy = copySpies ( MessageType . ISOM , MOCK_MOVIE )
@@ -140,14 +140,14 @@ describe('data copying', () => {
140
140
pipeline . flow ( )
141
141
142
142
pipeline . sink . incoming . on ( 'finish' , ( ) => {
143
- shouldCopy . forEach ( copy => expect ( copy ) . toHaveBeenCalled ( ) )
144
- shouldNotCopy . forEach ( copy => expect ( copy ) . not . toHaveBeenCalled ( ) )
143
+ shouldCopy . forEach ( ( copy ) => expect ( copy ) . toHaveBeenCalled ( ) )
144
+ shouldNotCopy . forEach ( ( copy ) => expect ( copy ) . not . toHaveBeenCalled ( ) )
145
145
expect ( captureHandler ) . toHaveBeenCalledWith ( MOCK_MOVIE_BUFFER )
146
146
done ( )
147
147
} )
148
148
} )
149
149
150
- test ( 'should stop when requested' , done => {
150
+ test ( 'should stop when requested' , ( done ) => {
151
151
const pipeline = pipelineFactory ( MOCK_MOVIE , MOCK_MOVIE_ENDING )
152
152
153
153
const shouldCopy = copySpies ( MessageType . ISOM , MOCK_MOVIE )
@@ -156,7 +156,7 @@ describe('data copying', () => {
156
156
// Activate capture.
157
157
const captureHandler = jest . fn ( )
158
158
pipeline . capture . start ( captureHandler )
159
- pipeline . source . incoming . on ( 'data' , msg => {
159
+ pipeline . source . incoming . on ( 'data' , ( msg ) => {
160
160
if ( msg . data [ 0 ] === 0xfe ) {
161
161
pipeline . capture . stop ( )
162
162
}
@@ -166,8 +166,8 @@ describe('data copying', () => {
166
166
pipeline . flow ( )
167
167
168
168
pipeline . sink . incoming . on ( 'finish' , ( ) => {
169
- shouldCopy . forEach ( copy => expect ( copy ) . toHaveBeenCalled ( ) )
170
- shouldNotCopy . forEach ( copy => expect ( copy ) . not . toHaveBeenCalled ( ) )
169
+ shouldCopy . forEach ( ( copy ) => expect ( copy ) . toHaveBeenCalled ( ) )
170
+ shouldNotCopy . forEach ( ( copy ) => expect ( copy ) . not . toHaveBeenCalled ( ) )
171
171
expect ( captureHandler ) . toHaveBeenCalledWith ( MOCK_MOVIE_BUFFER )
172
172
done ( )
173
173
} )
0 commit comments