Add tests for monitor module

This commit is contained in:
Alex Holliday
2024-11-05 16:03:37 +08:00
parent f3ec84d36f
commit 53fb79bbfb
2 changed files with 1582 additions and 2 deletions

View File

@@ -52,7 +52,6 @@ const calculateUptimeDuration = (checks) => {
if (!checks || checks.length === 0) {
return 0;
}
const latestCheck = new Date(checks[0].createdAt);
let latestDownCheck = 0;
@@ -439,7 +438,6 @@ const getMonitorsByTeamId = async (req, res) => {
if (limit === "-1") {
return { monitors, monitorCount };
}
// Map each monitor to include its associated checks
const monitorsWithChecks = await Promise.all(
monitors.map(async (monitor) => {
@@ -488,6 +486,7 @@ const createMonitor = async (req, res) => {
// Remove notifications fom monitor as they aren't needed here
monitor.notifications = undefined;
await monitor.save();
console.log(monitor);
return monitor;
} catch (error) {
error.service = SERVICE_NAME;

File diff suppressed because it is too large Load Diff