mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
a34c674971
* feat: add event search endpoint * refactor: expand variable names * refactor: add table type to query builder * refactor: improve schema limit/offset types * refactor: describe searchEventsSchema fields
31 lines
837 B
TypeScript
31 lines
837 B
TypeScript
import knex from 'knex';
|
|
import EventStore from './event-store';
|
|
import getLogger from '../../test/fixtures/no-logger';
|
|
|
|
beforeAll(() => {
|
|
getLogger.setMuteError(true);
|
|
});
|
|
|
|
afterAll(() => {
|
|
getLogger.setMuteError(false);
|
|
});
|
|
|
|
test('Trying to get events if db fails should yield empty list', async () => {
|
|
const db = knex({
|
|
client: 'pg',
|
|
});
|
|
const store = new EventStore(db, getLogger);
|
|
const events = await store.getEvents();
|
|
expect(events.length).toBe(0);
|
|
});
|
|
|
|
test('Trying to get events by name if db fails should yield empty list', async () => {
|
|
const db = knex({
|
|
client: 'pg',
|
|
});
|
|
const store = new EventStore(db, getLogger);
|
|
const events = await store.searchEvents({ type: 'application-created' });
|
|
expect(events).toBeTruthy();
|
|
expect(events.length).toBe(0);
|
|
});
|