Skip to content

Commit 55ce844

Browse files
committed
Fix unit test.
1 parent 24ab6eb commit 55ce844

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

test/unit/from/dynamodb.test.js

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ describe('from/dynamodb.js', () => {
907907
it('should ignore expired ttl', (done) => {
908908
const events = toDynamodbRecords([
909909
{
910-
timestamp: 1573005490000,
910+
timestamp: 1573005490,
911911
keys: {
912912
pk: '1',
913913
sk: 'thing',
@@ -922,7 +922,7 @@ describe('from/dynamodb.js', () => {
922922
ttlDelete: true,
923923
},
924924
{
925-
timestamp: 1573005490000,
925+
timestamp: 1573005490,
926926
keys: {
927927
pk: '1',
928928
sk: 'thing',
@@ -931,7 +931,7 @@ describe('from/dynamodb.js', () => {
931931
pk: '1',
932932
sk: 'thing',
933933
name: 'N1',
934-
ttl: 1573015490, // has expired, but event is not a ddb ttl remove
934+
ttl: 1573015491,
935935
timestamp: 1573005490000,
936936
},
937937
},
@@ -987,6 +987,45 @@ describe('from/dynamodb.js', () => {
987987
.done(done);
988988
});
989989

990+
it('should passes through record with no ttl if ignore ttl events is true', (done) => {
991+
const events = toDynamodbRecords([
992+
{
993+
timestamp: 1573005491,
994+
keys: {
995+
pk: '1',
996+
sk: 'thing',
997+
},
998+
oldImage: {
999+
pk: '1',
1000+
sk: 'thing',
1001+
name: 'N1',
1002+
timestamp: 1573005490000,
1003+
},
1004+
},
1005+
{
1006+
timestamp: 1573005490,
1007+
keys: {
1008+
pk: '1',
1009+
sk: 'thing',
1010+
},
1011+
oldImage: {
1012+
pk: '1',
1013+
sk: 'thing',
1014+
name: 'N1',
1015+
timestamp: 1573005490000,
1016+
},
1017+
},
1018+
]);
1019+
1020+
fromDynamodb(events, { ignoreTtlExpiredEvents: true })
1021+
.collect()
1022+
.tap((collected) => {
1023+
// console.log(JSON.stringify(collected, null, 2));
1024+
expect(collected.length).to.equal(2);
1025+
})
1026+
.done(done);
1027+
});
1028+
9901029
it('should keep replica records if ignoreReplicas is false', (done) => {
9911030
const events = toDynamodbRecords([
9921031
{

0 commit comments

Comments
 (0)