Skip to content

Commit

Permalink
Merge pull request #58 from bcgov/feature/rule-relations
Browse files Browse the repository at this point in the history
Add klamm service and controller for requesting rule info.
  • Loading branch information
brysonjbest authored Dec 17, 2024
2 parents da4d461 + ce8bd17 commit ed8bc14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/klamm/klamm.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
},
},
],
Expand All @@ -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);
});
});
5 changes: 5 additions & 0 deletions src/api/klamm/klamm.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<KlammField[]> {
return await this.klammService.getKlammBREFieldFromName(fieldName);
Expand Down

0 comments on commit ed8bc14

Please sign in to comment.