aws-lambda-stream
aws-lambda-stream copied to clipboard
filterOnEventType - unexpected behaviour handling array of strings
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);
...
Just noticed that there's another issue addressing same problem #135
Looks like its fixed by #385