import { DyFM_HttpCallType } from '@futdevpro/fsm-dynamo'; import { DyNTS_Scheduler_Controller } from './scheduler.controller'; describe('| DyNTS_Scheduler_Controller', (): void => { let controller: DyNTS_Scheduler_Controller; beforeEach((): void => { controller = DyNTS_Scheduler_Controller.getInstance(); }); it('| is a singleton instance', (): void => { const a: DyNTS_Scheduler_Controller = DyNTS_Scheduler_Controller.getInstance(); const b: DyNTS_Scheduler_Controller = DyNTS_Scheduler_Controller.getInstance(); expect(a).toBe(b); expect(a).toBeInstanceOf(DyNTS_Scheduler_Controller); }); it('| sets up the /runs endpoint', (): void => { controller.setupEndpoints(); expect(controller.endpoints).toBeDefined(); expect(controller.endpoints.length).toBeGreaterThan(0); const runsEndpoint = controller.endpoints.find((ep) => ep.name === 'getSchedulerRuns'); expect(runsEndpoint).toBeDefined(); expect(runsEndpoint?.type).toBe(DyFM_HttpCallType.get); }); it('| applies an auth preProcess when configured', (): void => { DyNTS_Scheduler_Controller.configure({ authPreProcess: async (): Promise => {}, }); controller.setupEndpoints(); const runsEndpoint = controller.endpoints.find((ep) => ep.name === 'getSchedulerRuns'); expect((runsEndpoint as any)?.preProcesses?.length).toBeGreaterThan(0); // visszaallitas, hogy ne szivarogjon at masik teszthez DyNTS_Scheduler_Controller.configure({}); }); });