some naming/organization changes
This commit is contained in:
parent
2b9fa53c5f
commit
767a5930a6
6 changed files with 11 additions and 11 deletions
5
src/workers/requester/index.ts
Normal file
5
src/workers/requester/index.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { Worker } from "../types"
|
||||
|
||||
export const work: Worker<undefined, void> = async (): Promise<void> => {
|
||||
return
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import { Worker } from "../types"
|
||||
|
||||
export const run: Worker<undefined, void> = async (): Promise<void> => {
|
||||
return
|
||||
}
|
||||
|
|
@ -21,11 +21,11 @@ export interface ReservationSchedulerInput
|
|||
dateRange: { start: string; end: string }
|
||||
}
|
||||
|
||||
export const run: Worker<ReservationSchedulerInput, ReservationSchedulerResult> = async (
|
||||
export const work: Worker<ReservationSchedulerInput, ReservationSchedulerResult> = async (
|
||||
payload: ReservationSchedulerInput,
|
||||
): Promise<ReservationSchedulerResult> => {
|
||||
Logger.instantiate('reservationScheduler', v4(), LogLevel.DEBUG)
|
||||
Logger.debug('Handling event', { payload })
|
||||
Logger.debug('Handling reservation', { payload })
|
||||
let reservationRequest: ReservationRequest
|
||||
try {
|
||||
reservationRequest = validateJSONRequest(payload)
|
||||
|
|
@ -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<ReservationSchedulerResult>({
|
||||
scheduledReservationRequest: {
|
||||
reservationRequest: {
|
||||
|
|
@ -38,7 +38,7 @@ describe('reservationScheduler', () => {
|
|||
opponent: { id: "123", name: "collin" }
|
||||
}
|
||||
|
||||
await expect(run(payload)).resolves.toMatchObject<ReservationSchedulerResult>({
|
||||
await expect(work(payload)).resolves.toMatchObject<ReservationSchedulerResult>({
|
||||
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))
|
||||
})
|
||||
Loading…
Add table
Reference in a new issue