diff --git a/src/workers/requester/index.ts b/src/workers/requester/index.ts new file mode 100644 index 0000000..4c324e8 --- /dev/null +++ b/src/workers/requester/index.ts @@ -0,0 +1,5 @@ +import { Worker } from "../types" + +export const work: Worker = async (): Promise => { + return +} diff --git a/src/workers/reservationRequestor/rollup.config.js b/src/workers/requester/rollup.config.js similarity index 100% rename from src/workers/reservationRequestor/rollup.config.js rename to src/workers/requester/rollup.config.js diff --git a/src/workers/reservationRequestor/index.ts b/src/workers/reservationRequestor/index.ts deleted file mode 100644 index ff2094c..0000000 --- a/src/workers/reservationRequestor/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Worker } from "../types" - -export const run: Worker = async (): Promise => { - return -} diff --git a/src/workers/reservationScheduler/index.ts b/src/workers/scheduler/index.ts similarity index 92% rename from src/workers/reservationScheduler/index.ts rename to src/workers/scheduler/index.ts index c2fa735..3180a05 100644 --- a/src/workers/reservationScheduler/index.ts +++ b/src/workers/scheduler/index.ts @@ -21,11 +21,11 @@ export interface ReservationSchedulerInput dateRange: { start: string; end: string } } -export const run: Worker = async ( +export const work: Worker = async ( payload: ReservationSchedulerInput, ): Promise => { Logger.instantiate('reservationScheduler', v4(), LogLevel.DEBUG) - Logger.debug('Handling event', { payload }) + Logger.debug('Handling reservation', { payload }) let reservationRequest: ReservationRequest try { reservationRequest = validateJSONRequest(payload) diff --git a/src/workers/reservationScheduler/rollup.config.js b/src/workers/scheduler/rollup.config.js similarity index 100% rename from src/workers/reservationScheduler/rollup.config.js rename to src/workers/scheduler/rollup.config.js diff --git a/tests/workers/reservationScheduler.test.ts b/tests/workers/scheduler.test.ts similarity index 88% rename from tests/workers/reservationScheduler.test.ts rename to tests/workers/scheduler.test.ts index d45b1cb..354e83e 100644 --- a/tests/workers/reservationScheduler.test.ts +++ b/tests/workers/scheduler.test.ts @@ -1,6 +1,6 @@ import dayjs from 'dayjs' import { ValidationError, ValidationErrorCode } from '../../src/common/request' -import { run, ReservationSchedulerInput, ReservationSchedulerResult } from '../../src/workers/reservationScheduler' +import { work, ReservationSchedulerInput, ReservationSchedulerResult } from '../../src/workers/scheduler' jest.mock('../../src/common/logger') @@ -16,7 +16,7 @@ describe('reservationScheduler', () => { opponent: { id: "123", name: "collin" } } - await expect(run(payload)).resolves + await expect(work(payload)).resolves .toMatchObject({ scheduledReservationRequest: { reservationRequest: { @@ -38,7 +38,7 @@ describe('reservationScheduler', () => { opponent: { id: "123", name: "collin" } } - await expect(run(payload)).resolves.toMatchObject({ + await expect(work(payload)).resolves.toMatchObject({ scheduledReservationRequest: { reservationRequest: { username: 'collin', @@ -61,7 +61,7 @@ describe('reservationScheduler', () => { opponent: { id: "123", name: "collin" } } - await expect(run(payload)) + await expect(work(payload)) .rejects .toThrowError(new ValidationError('Invalid request', ValidationErrorCode.INVALID_REQUEST_BODY)) })