-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathindex.js
51 lines (48 loc) · 1.16 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const getReportResults = require("../services/getReportResults");
const suitesInput = require("../__fixtures__/suitesInput.json");
const suitesOutput = require("../__fixtures__/suitesOutput.json");
const registerRoutes = (server) => {
server.get(
"/",
{
schema: {
hide: true,
},
},
(req, reply) => {
reply.redirect("/api/docs");
}
);
server.post(
"/test-suite-manager/generate-report",
{
schema: {
tags: ["Test Suite Manager"],
summary: "Generate Report",
description: "Run tests on supplied suites",
body: {
type: "object",
example: suitesInput,
additionalProperties: true,
},
response: {
200: {
description: "Success",
type: "object",
example: suitesOutput,
additionalProperties: true,
},
},
},
},
async (req, reply) => {
try {
response = await getReportResults(req.body);
reply.send(response);
} catch (e) {
reply.status(500).send({ error: e.message });
}
}
);
};
module.exports = { registerRoutes };