File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -115,9 +115,17 @@ abstract class BasePartialProcessor {
115
115
/**
116
116
* If this is a sync processor, user should have called processSync instead,
117
117
* so we call the method early to throw the error early thus failing fast.
118
+ *
119
+ * The type casting is necessary to ensure that we have test coverage for the
120
+ * block of code that throws the error, without having to change the return type
121
+ * of the method. This is because this call will always throw an error.
118
122
*/
119
- if ( this . constructor . name === 'BatchProcessorSync' )
120
- await this . processRecord ( this . records [ 0 ] ) ;
123
+ if ( this . constructor . name === 'BatchProcessorSync' ) {
124
+ return ( await this . processRecord ( this . records [ 0 ] ) ) as (
125
+ | SuccessResponse
126
+ | FailureResponse
127
+ ) [ ] ;
128
+ }
121
129
this . prepare ( ) ;
122
130
123
131
const processingPromises : Promise < SuccessResponse | FailureResponse > [ ] =
You can’t perform that action at this time.
0 commit comments