aws-lambda-stream icon indicating copy to clipboard operation
aws-lambda-stream copied to clipboard

filterOnEventType - unexpected behaviour handling array of strings

Open vsnig opened this issue 1 year ago • 1 comments

I thought when providing an array of strings it should filter on exact match But:

const rule = { eventType: ['specific-thing-changed'] }
const uow = { event: { type: 'thing-changed' } }
expect(filterOnEventType(rule, uow)).toBe(false) <--- will fail

This is due to this check https://github.com/jgilbert01/aws-lambda-stream/blob/c678b09d63d6a5c8537fc6f5fe5660e743314ccb/src/filters/event.js#L10

I think it should be:

...
return rule.eventType.includes(uow.event.type);
...

vsnig avatar Mar 06 '24 13:03 vsnig

Just noticed that there's another issue addressing same problem #135

vsnig avatar Mar 06 '24 21:03 vsnig

Looks like its fixed by #385

vsnig avatar Sep 29 '24 14:09 vsnig