6
6
7
7
import { BatchProcessingError , BatchProcessor , EventType } from '../../src' ;
8
8
import {
9
- sqsEventFactory ,
10
- kinesisEventFactory ,
11
- dynamodbEventFactory ,
9
+ sqsRecordFactory ,
10
+ kinesisRecordFactory ,
11
+ dynamodbRecordFactory ,
12
12
} from '../../tests/helpers/factories' ;
13
13
import {
14
14
sqsRecordHandler ,
@@ -35,8 +35,8 @@ describe('Class: BatchProcessor', () => {
35
35
describe ( 'Synchronously processing SQS Records' , ( ) => {
36
36
test ( 'Batch processing SQS records with no failures' , async ( ) => {
37
37
// Prepare
38
- const firstRecord = sqsEventFactory ( 'success' ) ;
39
- const secondRecord = sqsEventFactory ( 'success' ) ;
38
+ const firstRecord = sqsRecordFactory ( 'success' ) ;
39
+ const secondRecord = sqsRecordFactory ( 'success' ) ;
40
40
const records = [ firstRecord , secondRecord ] ;
41
41
const processor = new BatchProcessor ( EventType . SQS ) ;
42
42
@@ -53,9 +53,9 @@ describe('Class: BatchProcessor', () => {
53
53
54
54
test ( 'Batch processing SQS records with some failures' , async ( ) => {
55
55
// Prepare
56
- const firstRecord = sqsEventFactory ( 'failure' ) ;
57
- const secondRecord = sqsEventFactory ( 'success' ) ;
58
- const thirdRecord = sqsEventFactory ( 'fail' ) ;
56
+ const firstRecord = sqsRecordFactory ( 'failure' ) ;
57
+ const secondRecord = sqsRecordFactory ( 'success' ) ;
58
+ const thirdRecord = sqsRecordFactory ( 'fail' ) ;
59
59
const records = [ firstRecord , secondRecord , thirdRecord ] ;
60
60
const processor = new BatchProcessor ( EventType . SQS ) ;
61
61
@@ -80,9 +80,9 @@ describe('Class: BatchProcessor', () => {
80
80
81
81
test ( 'Batch processing SQS records with all failures' , async ( ) => {
82
82
// Prepare
83
- const firstRecord = sqsEventFactory ( 'failure' ) ;
84
- const secondRecord = sqsEventFactory ( 'failure' ) ;
85
- const thirdRecord = sqsEventFactory ( 'fail' ) ;
83
+ const firstRecord = sqsRecordFactory ( 'failure' ) ;
84
+ const secondRecord = sqsRecordFactory ( 'failure' ) ;
85
+ const thirdRecord = sqsRecordFactory ( 'fail' ) ;
86
86
87
87
const records = [ firstRecord , secondRecord , thirdRecord ] ;
88
88
const processor = new BatchProcessor ( EventType . SQS ) ;
@@ -98,8 +98,8 @@ describe('Class: BatchProcessor', () => {
98
98
describe ( 'Asynchronously processing SQS Records' , ( ) => {
99
99
test ( 'Batch processing SQS records with no failures' , async ( ) => {
100
100
// Prepare
101
- const firstRecord = sqsEventFactory ( 'success' ) ;
102
- const secondRecord = sqsEventFactory ( 'success' ) ;
101
+ const firstRecord = sqsRecordFactory ( 'success' ) ;
102
+ const secondRecord = sqsRecordFactory ( 'success' ) ;
103
103
const records = [ firstRecord , secondRecord ] ;
104
104
const processor = new BatchProcessor ( EventType . SQS ) ;
105
105
@@ -116,9 +116,9 @@ describe('Class: BatchProcessor', () => {
116
116
117
117
test ( 'Batch processing SQS records with some failures' , async ( ) => {
118
118
// Prepare
119
- const firstRecord = sqsEventFactory ( 'failure' ) ;
120
- const secondRecord = sqsEventFactory ( 'success' ) ;
121
- const thirdRecord = sqsEventFactory ( 'fail' ) ;
119
+ const firstRecord = sqsRecordFactory ( 'failure' ) ;
120
+ const secondRecord = sqsRecordFactory ( 'success' ) ;
121
+ const thirdRecord = sqsRecordFactory ( 'fail' ) ;
122
122
const records = [ firstRecord , secondRecord , thirdRecord ] ;
123
123
const processor = new BatchProcessor ( EventType . SQS ) ;
124
124
@@ -143,9 +143,9 @@ describe('Class: BatchProcessor', () => {
143
143
144
144
test ( 'Batch processing SQS records with all failures' , async ( ) => {
145
145
// Prepare
146
- const firstRecord = sqsEventFactory ( 'failure' ) ;
147
- const secondRecord = sqsEventFactory ( 'failure' ) ;
148
- const thirdRecord = sqsEventFactory ( 'fail' ) ;
146
+ const firstRecord = sqsRecordFactory ( 'failure' ) ;
147
+ const secondRecord = sqsRecordFactory ( 'failure' ) ;
148
+ const thirdRecord = sqsRecordFactory ( 'fail' ) ;
149
149
150
150
const records = [ firstRecord , secondRecord , thirdRecord ] ;
151
151
const processor = new BatchProcessor ( EventType . SQS ) ;
@@ -163,8 +163,8 @@ describe('Class: BatchProcessor', () => {
163
163
describe ( 'Synchronously processing Kinesis Records' , ( ) => {
164
164
test ( 'Batch processing Kinesis records with no failures' , async ( ) => {
165
165
// Prepare
166
- const firstRecord = kinesisEventFactory ( 'success' ) ;
167
- const secondRecord = kinesisEventFactory ( 'success' ) ;
166
+ const firstRecord = kinesisRecordFactory ( 'success' ) ;
167
+ const secondRecord = kinesisRecordFactory ( 'success' ) ;
168
168
const records = [ firstRecord , secondRecord ] ;
169
169
const processor = new BatchProcessor ( EventType . KinesisDataStreams ) ;
170
170
@@ -181,9 +181,9 @@ describe('Class: BatchProcessor', () => {
181
181
182
182
test ( 'Batch processing Kinesis records with some failures' , async ( ) => {
183
183
// Prepare
184
- const firstRecord = kinesisEventFactory ( 'failure' ) ;
185
- const secondRecord = kinesisEventFactory ( 'success' ) ;
186
- const thirdRecord = kinesisEventFactory ( 'fail' ) ;
184
+ const firstRecord = kinesisRecordFactory ( 'failure' ) ;
185
+ const secondRecord = kinesisRecordFactory ( 'success' ) ;
186
+ const thirdRecord = kinesisRecordFactory ( 'fail' ) ;
187
187
const records = [ firstRecord , secondRecord , thirdRecord ] ;
188
188
const processor = new BatchProcessor ( EventType . KinesisDataStreams ) ;
189
189
@@ -207,9 +207,9 @@ describe('Class: BatchProcessor', () => {
207
207
} ) ;
208
208
209
209
test ( 'Batch processing Kinesis records with all failures' , async ( ) => {
210
- const firstRecord = kinesisEventFactory ( 'failure' ) ;
211
- const secondRecord = kinesisEventFactory ( 'failure' ) ;
212
- const thirdRecord = kinesisEventFactory ( 'fail' ) ;
210
+ const firstRecord = kinesisRecordFactory ( 'failure' ) ;
211
+ const secondRecord = kinesisRecordFactory ( 'failure' ) ;
212
+ const thirdRecord = kinesisRecordFactory ( 'fail' ) ;
213
213
214
214
const records = [ firstRecord , secondRecord , thirdRecord ] ;
215
215
const processor = new BatchProcessor ( EventType . KinesisDataStreams ) ;
@@ -227,8 +227,8 @@ describe('Class: BatchProcessor', () => {
227
227
describe ( 'Asynchronously processing Kinesis Records' , ( ) => {
228
228
test ( 'Batch processing Kinesis records with no failures' , async ( ) => {
229
229
// Prepare
230
- const firstRecord = kinesisEventFactory ( 'success' ) ;
231
- const secondRecord = kinesisEventFactory ( 'success' ) ;
230
+ const firstRecord = kinesisRecordFactory ( 'success' ) ;
231
+ const secondRecord = kinesisRecordFactory ( 'success' ) ;
232
232
const records = [ firstRecord , secondRecord ] ;
233
233
const processor = new BatchProcessor ( EventType . KinesisDataStreams ) ;
234
234
@@ -245,9 +245,9 @@ describe('Class: BatchProcessor', () => {
245
245
246
246
test ( 'Batch processing Kinesis records with some failures' , async ( ) => {
247
247
// Prepare
248
- const firstRecord = kinesisEventFactory ( 'failure' ) ;
249
- const secondRecord = kinesisEventFactory ( 'success' ) ;
250
- const thirdRecord = kinesisEventFactory ( 'fail' ) ;
248
+ const firstRecord = kinesisRecordFactory ( 'failure' ) ;
249
+ const secondRecord = kinesisRecordFactory ( 'success' ) ;
250
+ const thirdRecord = kinesisRecordFactory ( 'fail' ) ;
251
251
const records = [ firstRecord , secondRecord , thirdRecord ] ;
252
252
const processor = new BatchProcessor ( EventType . KinesisDataStreams ) ;
253
253
@@ -272,9 +272,9 @@ describe('Class: BatchProcessor', () => {
272
272
273
273
test ( 'Batch processing Kinesis records with all failures' , async ( ) => {
274
274
// Prepare
275
- const firstRecord = kinesisEventFactory ( 'failure' ) ;
276
- const secondRecord = kinesisEventFactory ( 'failure' ) ;
277
- const thirdRecord = kinesisEventFactory ( 'fail' ) ;
275
+ const firstRecord = kinesisRecordFactory ( 'failure' ) ;
276
+ const secondRecord = kinesisRecordFactory ( 'failure' ) ;
277
+ const thirdRecord = kinesisRecordFactory ( 'fail' ) ;
278
278
279
279
const records = [ firstRecord , secondRecord , thirdRecord ] ;
280
280
const processor = new BatchProcessor ( EventType . KinesisDataStreams ) ;
@@ -292,8 +292,8 @@ describe('Class: BatchProcessor', () => {
292
292
describe ( 'Synchronously processing DynamoDB Records' , ( ) => {
293
293
test ( 'Batch processing DynamoDB records with no failures' , async ( ) => {
294
294
// Prepare
295
- const firstRecord = dynamodbEventFactory ( 'success' ) ;
296
- const secondRecord = dynamodbEventFactory ( 'success' ) ;
295
+ const firstRecord = dynamodbRecordFactory ( 'success' ) ;
296
+ const secondRecord = dynamodbRecordFactory ( 'success' ) ;
297
297
const records = [ firstRecord , secondRecord ] ;
298
298
const processor = new BatchProcessor ( EventType . DynamoDBStreams ) ;
299
299
@@ -308,11 +308,11 @@ describe('Class: BatchProcessor', () => {
308
308
] ) ;
309
309
} ) ;
310
310
311
- test ( 'Batch processing DynamoDB records with failures' , async ( ) => {
311
+ test ( 'Batch processing DynamoDB records with some failures' , async ( ) => {
312
312
// Prepare
313
- const firstRecord = dynamodbEventFactory ( 'failure' ) ;
314
- const secondRecord = dynamodbEventFactory ( 'success' ) ;
315
- const thirdRecord = dynamodbEventFactory ( 'fail' ) ;
313
+ const firstRecord = dynamodbRecordFactory ( 'failure' ) ;
314
+ const secondRecord = dynamodbRecordFactory ( 'success' ) ;
315
+ const thirdRecord = dynamodbRecordFactory ( 'fail' ) ;
316
316
const records = [ firstRecord , secondRecord , thirdRecord ] ;
317
317
const processor = new BatchProcessor ( EventType . DynamoDBStreams ) ;
318
318
@@ -337,9 +337,9 @@ describe('Class: BatchProcessor', () => {
337
337
338
338
test ( 'Batch processing DynamoDB records with all failures' , async ( ) => {
339
339
// Prepare
340
- const firstRecord = dynamodbEventFactory ( 'failure' ) ;
341
- const secondRecord = dynamodbEventFactory ( 'failure' ) ;
342
- const thirdRecord = dynamodbEventFactory ( 'fail' ) ;
340
+ const firstRecord = dynamodbRecordFactory ( 'failure' ) ;
341
+ const secondRecord = dynamodbRecordFactory ( 'failure' ) ;
342
+ const thirdRecord = dynamodbRecordFactory ( 'fail' ) ;
343
343
344
344
const records = [ firstRecord , secondRecord , thirdRecord ] ;
345
345
const processor = new BatchProcessor ( EventType . DynamoDBStreams ) ;
@@ -357,8 +357,8 @@ describe('Class: BatchProcessor', () => {
357
357
describe ( 'Asynchronously processing DynamoDB Records' , ( ) => {
358
358
test ( 'Batch processing DynamoDB records with no failures' , async ( ) => {
359
359
// Prepare
360
- const firstRecord = dynamodbEventFactory ( 'success' ) ;
361
- const secondRecord = dynamodbEventFactory ( 'success' ) ;
360
+ const firstRecord = dynamodbRecordFactory ( 'success' ) ;
361
+ const secondRecord = dynamodbRecordFactory ( 'success' ) ;
362
362
const records = [ firstRecord , secondRecord ] ;
363
363
const processor = new BatchProcessor ( EventType . DynamoDBStreams ) ;
364
364
@@ -373,11 +373,11 @@ describe('Class: BatchProcessor', () => {
373
373
] ) ;
374
374
} ) ;
375
375
376
- test ( 'Batch processing DynamoDB records with failures' , async ( ) => {
376
+ test ( 'Batch processing DynamoDB records with some failures' , async ( ) => {
377
377
// Prepare
378
- const firstRecord = dynamodbEventFactory ( 'failure' ) ;
379
- const secondRecord = dynamodbEventFactory ( 'success' ) ;
380
- const thirdRecord = dynamodbEventFactory ( 'fail' ) ;
378
+ const firstRecord = dynamodbRecordFactory ( 'failure' ) ;
379
+ const secondRecord = dynamodbRecordFactory ( 'success' ) ;
380
+ const thirdRecord = dynamodbRecordFactory ( 'fail' ) ;
381
381
const records = [ firstRecord , secondRecord , thirdRecord ] ;
382
382
const processor = new BatchProcessor ( EventType . DynamoDBStreams ) ;
383
383
@@ -402,9 +402,9 @@ describe('Class: BatchProcessor', () => {
402
402
403
403
test ( 'Batch processing DynamoDB records with all failures' , async ( ) => {
404
404
// Prepare
405
- const firstRecord = dynamodbEventFactory ( 'failure' ) ;
406
- const secondRecord = dynamodbEventFactory ( 'failure' ) ;
407
- const thirdRecord = dynamodbEventFactory ( 'fail' ) ;
405
+ const firstRecord = dynamodbRecordFactory ( 'failure' ) ;
406
+ const secondRecord = dynamodbRecordFactory ( 'failure' ) ;
407
+ const thirdRecord = dynamodbRecordFactory ( 'fail' ) ;
408
408
409
409
const records = [ firstRecord , secondRecord , thirdRecord ] ;
410
410
const processor = new BatchProcessor ( EventType . DynamoDBStreams ) ;
0 commit comments