diff --git a/src/api/klamm/klamm.controller.spec.ts b/src/api/klamm/klamm.controller.spec.ts index 4d56aae..db03c80 100644 --- a/src/api/klamm/klamm.controller.spec.ts +++ b/src/api/klamm/klamm.controller.spec.ts @@ -15,6 +15,7 @@ describe('KlammController', () => { useValue: { getKlammBREFields: jest.fn(() => Promise.resolve('expected result')), getKlammBREFieldFromName: jest.fn((fieldName) => Promise.resolve(`result for ${fieldName}`)), // Mock implementation + _getAllKlammFields: jest.fn(() => Promise.resolve('rules result')), }, }, ], @@ -35,4 +36,9 @@ describe('KlammController', () => { expect(service.getKlammBREFieldFromName).toHaveBeenCalledWith(fieldName); expect(service.getKlammBREFieldFromName).toHaveBeenCalledTimes(1); }); + + it('should call _getAllKlammFields and return expected result', async () => { + expect(await controller.getKlammBRERules()).toBe('rules result'); + expect(service._getAllKlammFields).toHaveBeenCalledTimes(1); + }); }); diff --git a/src/api/klamm/klamm.controller.ts b/src/api/klamm/klamm.controller.ts index d44652f..9080f61 100644 --- a/src/api/klamm/klamm.controller.ts +++ b/src/api/klamm/klamm.controller.ts @@ -11,6 +11,11 @@ export class KlammController { return await this.klammService.getKlammBREFields(searchText); } + @Get('/brerules') + async getKlammBRERules() { + return await this.klammService._getAllKlammFields(); + } + @Get('/brefield/:fieldName') async getKlammBREFieldFromName(@Param('fieldName') fieldName: string): Promise { return await this.klammService.getKlammBREFieldFromName(fieldName);