diff --git a/filter.test.ts b/filter.test.ts index b7f9cea..3ca3f10 100644 --- a/filter.test.ts +++ b/filter.test.ts @@ -115,6 +115,16 @@ describe('Filter', () => { expect(result).toEqual(false) }) + it('should return true when the timestamp of event is equal to the filter since value', () => { + const filter = {since: 100} + + const event = buildEvent({created_at: 100}) + + const result = matchFilter(filter, event) + + expect(result).toEqual(true) + }) + it('should return false when the event is after the filter until value', () => { const filter = {until: 100} @@ -124,6 +134,16 @@ describe('Filter', () => { expect(result).toEqual(false) }) + + it('should return true when the timestamp of event is equal to the filter until value', () => { + const filter = {until: 100} + + const event = buildEvent({created_at: 100}) + + const result = matchFilter(filter, event) + + expect(result).toEqual(true) + }) }) describe('matchFilters', () => { diff --git a/filter.ts b/filter.ts index d6fe610..bd59c08 100644 --- a/filter.ts +++ b/filter.ts @@ -42,7 +42,7 @@ export function matchFilter( } if (filter.since && event.created_at < filter.since) return false - if (filter.until && event.created_at >= filter.until) return false + if (filter.until && event.created_at > filter.until) return false return true }