Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3acfbd9

Browse files
committedAug 19, 2024·
chore: test coverage
1 parent 384fb4d commit 3acfbd9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎packages/batch/src/BasePartialProcessor.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,17 @@ abstract class BasePartialProcessor {
115115
/**
116116
* If this is a sync processor, user should have called processSync instead,
117117
* 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.
118122
*/
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+
}
121129
this.prepare();
122130

123131
const processingPromises: Promise<SuccessResponse | FailureResponse>[] =

0 commit comments

Comments
 (0)
Please sign in to comment.