Modify sonarqube frontend plugin to call the new sonarqube backend
backend only have mock API for now Signed-off-by: Neemys <36508659+Neemys@users.noreply.github.com>
This commit is contained in:
@@ -34,12 +34,18 @@ describe('createRouter', () => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
describe('GET /health', () => {
|
||||
describe('GET /findings', () => {
|
||||
it('returns ok', async () => {
|
||||
const response = await request(app).get('/health');
|
||||
const response = await request(app)
|
||||
.get('/findings')
|
||||
.set('componentKey', 'my:app')
|
||||
.send();
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.body).toEqual({ status: 'ok' });
|
||||
expect(response.body).toEqual({
|
||||
analysisDate: '2022-10-22T04:55:23Z',
|
||||
measures: [{ metric: 'coverage', value: '50' }],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -30,10 +30,13 @@ export async function createRouter(
|
||||
|
||||
const router = Router();
|
||||
router.use(express.json());
|
||||
|
||||
router.get('/health', (_, response) => {
|
||||
logger.info('PONG!');
|
||||
response.send({ status: 'ok' });
|
||||
// mock api for now
|
||||
router.get('/findings', (request, response) => {
|
||||
logger.info(request.params);
|
||||
response.send({
|
||||
analysisDate: '2022-10-22T04:55:23Z',
|
||||
measures: [{ metric: 'coverage', value: '50' }],
|
||||
});
|
||||
});
|
||||
router.use(errorHandler());
|
||||
return router;
|
||||
|
||||
Reference in New Issue
Block a user