Cleaning up router and its tests
Signed-off-by: Andre Wanlin <awanlin@rapidrtc.com>
This commit is contained in:
@@ -83,7 +83,7 @@ describe('createRouter', () => {
|
||||
azureDevOpsApi.getGitRepository.mockResolvedValueOnce(gitRepository);
|
||||
|
||||
const response = await request(app).get(
|
||||
`/repository/${'myProject'}/${'myRepo'}`,
|
||||
'/repository/myProject/myRepo',
|
||||
);
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
@@ -128,7 +128,7 @@ describe('createRouter', () => {
|
||||
azureDevOpsApi.getBuildList.mockResolvedValueOnce(builds);
|
||||
|
||||
const response = await request(app).get(
|
||||
`/builds/${'myProject'}/${'af4ae3af-e747-4129-9bbc-d1329f6b0998'}`,
|
||||
'/builds/myProject/af4ae3af-e747-4129-9bbc-d1329f6b0998',
|
||||
);
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
@@ -177,7 +177,7 @@ describe('createRouter', () => {
|
||||
azureDevOpsApi.getRepoBuilds.mockResolvedValueOnce(repoBuilds);
|
||||
|
||||
const response = await request(app).get(
|
||||
`/repo-builds/${'myProject'}/${'myRepo'}`,
|
||||
'/repo-builds/myProject/myRepo',
|
||||
);
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
|
||||
@@ -77,8 +77,7 @@ export async function createRouter(
|
||||
details = 'Organization is missing';
|
||||
}
|
||||
|
||||
logger.info('PONG!');
|
||||
response.status(code).send({ status: status, details: details });
|
||||
response.status(code).json({ status: status, details: details });
|
||||
});
|
||||
|
||||
router.get('/repository/:projectName/:repoName', async (req, res) => {
|
||||
@@ -87,13 +86,13 @@ export async function createRouter(
|
||||
projectName,
|
||||
repoName,
|
||||
);
|
||||
res.status(200).send(gitRepository);
|
||||
res.status(200).json(gitRepository);
|
||||
});
|
||||
|
||||
router.get('/builds/:projectName/:repoId', async (req, res) => {
|
||||
const { projectName, repoId } = req.params;
|
||||
const buildList = await azureDevOpsApi.getBuildList(projectName, repoId);
|
||||
res.status(200).send(buildList);
|
||||
res.status(200).json(buildList);
|
||||
});
|
||||
|
||||
router.get('/repo-builds/:projectName/:repoName', async (req, res) => {
|
||||
@@ -102,7 +101,7 @@ export async function createRouter(
|
||||
projectName,
|
||||
repoName,
|
||||
);
|
||||
res.status(200).send(gitRepository);
|
||||
res.status(200).json(gitRepository);
|
||||
});
|
||||
|
||||
router.use(errorHandler());
|
||||
|
||||
Reference in New Issue
Block a user