import { DyNTS_Test_Controller } from './test.controller'; import { DyNTS_GlobalService } from '../../_services/core/global.service'; import { DyFM_HttpCallType } from '@futdevpro/fsm-dynamo'; describe('| DyNTS_Test_Controller', () => { let controller: DyNTS_Test_Controller; beforeEach(() => { controller = DyNTS_Test_Controller.getInstance(); }); it('| should be a singleton instance', () => { const instance1 = DyNTS_Test_Controller.getInstance(); const instance2 = DyNTS_Test_Controller.getInstance(); expect(instance1).toBe(instance2); expect(instance1).toBeInstanceOf(DyNTS_Test_Controller); }); it('| should setup endpoints', () => { controller.setupEndpoints(); expect(controller.endpoints).toBeDefined(); expect(controller.endpoints.length).toBeGreaterThan(0); }); it('| should have testGet endpoint', () => { controller.setupEndpoints(); const testGetEndpoint = controller.endpoints.find(ep => ep.name === 'testGet'); expect(testGetEndpoint).toBeDefined(); expect(testGetEndpoint?.type).toBe(DyFM_HttpCallType.get); expect((testGetEndpoint as any)?.tasks).toBeDefined(); expect((testGetEndpoint as any)?.tasks.length).toBeGreaterThan(0); }); it('| should have testPost endpoint', () => { controller.setupEndpoints(); const testPostEndpoint = controller.endpoints.find(ep => ep.name === 'testPost'); expect(testPostEndpoint).toBeDefined(); expect(testPostEndpoint?.type).toBe(DyFM_HttpCallType.post); expect((testPostEndpoint as any)?.tasks).toBeDefined(); expect((testPostEndpoint as any)?.tasks.length).toBeGreaterThan(0); }); it('| should have testDelete endpoint', () => { controller.setupEndpoints(); const testDeleteEndpoint = controller.endpoints.find(ep => ep.name === 'testDelete'); expect(testDeleteEndpoint).toBeDefined(); expect(testDeleteEndpoint?.type).toBe(DyFM_HttpCallType.delete); expect((testDeleteEndpoint as any)?.tasks).toBeDefined(); expect((testDeleteEndpoint as any)?.tasks.length).toBeGreaterThan(0); }); it('| should have getServerStatus endpoint', () => { controller.setupEndpoints(); const getServerStatusEndpoint = controller.endpoints.find(ep => ep.name === 'getServerStatus'); expect(getServerStatusEndpoint).toBeDefined(); expect(getServerStatusEndpoint?.type).toBe(DyFM_HttpCallType.get); expect((getServerStatusEndpoint as any)?.tasks).toBeDefined(); expect((getServerStatusEndpoint as any)?.tasks.length).toBeGreaterThan(0); }); });