Add tests for monitor module
This commit is contained in:
1 parent
f3ec84d36f
commit
53fb79bbfb
2 files changed
+1582
-2
No files matched your search
@@ -52,7 +52,6 @@ const calculateUptimeDuration = (checks) => {
|
|||||||
if (!checks || checks.length === 0) {
|
if (!checks || checks.length === 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const latestCheck = new Date(checks[0].createdAt);
|
const latestCheck = new Date(checks[0].createdAt);
|
||||||
let latestDownCheck = 0;
|
let latestDownCheck = 0;
|
||||||
|
|
||||||
@@ -439,7 +438,6 @@ const getMonitorsByTeamId = async (req, res) => {
|
|||||||
if (limit === "-1") {
|
if (limit === "-1") {
|
||||||
return { monitors, monitorCount };
|
return { monitors, monitorCount };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map each monitor to include its associated checks
|
// Map each monitor to include its associated checks
|
||||||
const monitorsWithChecks = await Promise.all(
|
const monitorsWithChecks = await Promise.all(
|
||||||
monitors.map(async (monitor) => {
|
monitors.map(async (monitor) => {
|
||||||
@@ -488,6 +486,7 @@ const createMonitor = async (req, res) => {
|
|||||||
// Remove notifications fom monitor as they aren't needed here
|
// Remove notifications fom monitor as they aren't needed here
|
||||||
monitor.notifications = undefined;
|
monitor.notifications = undefined;
|
||||||
await monitor.save();
|
await monitor.save();
|
||||||
|
console.log(monitor);
|
||||||
return monitor;
|
return monitor;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
error.service = SERVICE_NAME;
|
error.service = SERVICE_NAME;
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user