import { DyNTS_CustomData_Controller } from './custom-data.controller'; import { DyFM_HttpCallType } from '@futdevpro/fsm-dynamo'; describe('| DyNTS_CustomData_Controller', () => { let controller: DyNTS_CustomData_Controller; beforeEach(() => { controller = DyNTS_CustomData_Controller.getInstance(); }); it('| should be a singleton instance', () => { const instance1 = DyNTS_CustomData_Controller.getInstance(); const instance2 = DyNTS_CustomData_Controller.getInstance(); expect(instance1).toBe(instance2); expect(instance1).toBeInstanceOf(DyNTS_CustomData_Controller); }); it('| should setup endpoints', () => { controller.setupEndpoints(); expect(controller.endpoints).toBeDefined(); expect(controller.endpoints.length).toBeGreaterThan(0); }); it('| should have getCustomData endpoint', () => { controller.setupEndpoints(); const getCustomDataEndpoint = controller.endpoints.find(ep => ep.name === 'getCustomData'); expect(getCustomDataEndpoint).toBeDefined(); expect(getCustomDataEndpoint?.type).toBe(DyFM_HttpCallType.get); expect((getCustomDataEndpoint as any)?.tasks).toBeDefined(); expect((getCustomDataEndpoint as any)?.tasks.length).toBeGreaterThan(0); }); it('| should have modifyCustomData endpoint', () => { controller.setupEndpoints(); const modifyCustomDataEndpoint = controller.endpoints.find(ep => ep.name === 'modifyCustomData'); expect(modifyCustomDataEndpoint).toBeDefined(); expect(modifyCustomDataEndpoint?.type).toBe(DyFM_HttpCallType.post); expect((modifyCustomDataEndpoint as any)?.tasks).toBeDefined(); expect((modifyCustomDataEndpoint as any)?.tasks.length).toBeGreaterThan(0); }); });