diff --git a/packages/common/src/interfaces/event-repository.interface.ts b/packages/common/src/interfaces/event-repository.interface.ts index 3ee3eb34..e575f7be 100644 --- a/packages/common/src/interfaces/event-repository.interface.ts +++ b/packages/common/src/interfaces/event-repository.interface.ts @@ -21,7 +21,7 @@ export abstract class EventRepository { /** * This property indicates whether the search feature is supported. */ - readonly isSearchSupported: boolean = false; + abstract isSearchSupported(): boolean; /** * This method is called when a new event should be stored. You should handle diff --git a/packages/core/__test__/services/event.service.spec.ts b/packages/core/__test__/services/event.service.spec.ts index aaa78631..f3251f53 100644 --- a/packages/core/__test__/services/event.service.spec.ts +++ b/packages/core/__test__/services/event.service.spec.ts @@ -21,7 +21,7 @@ describe('eventService', () => { beforeEach(() => { eventRepository = { - isSearchSupported: false, + isSearchSupported: jest.fn().mockReturnValue(false), upsert: jest.fn(), find: jest.fn(), findOne: jest.fn(), diff --git a/packages/core/src/services/event.service.ts b/packages/core/src/services/event.service.ts index 8c15b282..94872e8c 100644 --- a/packages/core/src/services/event.service.ts +++ b/packages/core/src/services/event.service.ts @@ -123,7 +123,7 @@ export class EventService { const callback = async (): Promise => { if ( filter.search !== undefined && - !this.eventRepository.isSearchSupported + !this.eventRepository.isSearchSupported() ) { return []; } diff --git a/packages/event-repository-sqlite/__test__/event-repository-sqlite.spec.ts b/packages/event-repository-sqlite/__test__/event-repository-sqlite.spec.ts index 3a3473bf..36632c57 100644 --- a/packages/event-repository-sqlite/__test__/event-repository-sqlite.spec.ts +++ b/packages/event-repository-sqlite/__test__/event-repository-sqlite.spec.ts @@ -16,6 +16,12 @@ describe('EventRepositorySqlite', () => { eventRepository.close(); }); + describe('isSearchSupported', () => { + it('should return false', () => { + expect(eventRepository.isSearchSupported()).toBe(false); + }); + }); + describe('upsert', () => { it('should insert a new event', async () => { const eventA = createEvent({ diff --git a/packages/event-repository-sqlite/src/event-repository-sqlite.ts b/packages/event-repository-sqlite/src/event-repository-sqlite.ts index 3f96dac0..f448eac2 100644 --- a/packages/event-repository-sqlite/src/event-repository-sqlite.ts +++ b/packages/event-repository-sqlite/src/event-repository-sqlite.ts @@ -20,6 +20,10 @@ export class EventRepositorySqlite extends EventRepository { this.migrate(); } + isSearchSupported(): boolean { + return false; + } + close(): void { this.db.close(); }