mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-24 02:29:35 -06:00
Add missing test case for docker monitor type
This commit is contained in:
@@ -891,6 +891,18 @@ describe("monitorModule", () => {
|
||||
url: "https://test.com",
|
||||
}),
|
||||
};
|
||||
const mockMonitorDocker = {
|
||||
_id: "monitor123",
|
||||
type: "docker",
|
||||
name: "Test Monitor",
|
||||
url: "https://test.com",
|
||||
toObject: () => ({
|
||||
_id: "monitor123",
|
||||
type: "http",
|
||||
name: "Test Monitor",
|
||||
url: "https://test.com",
|
||||
}),
|
||||
};
|
||||
|
||||
const checkDocs = [
|
||||
{
|
||||
@@ -1004,6 +1016,30 @@ describe("monitorModule", () => {
|
||||
expect(result.periodUptime).to.be.a("number");
|
||||
expect(result.aggregateData).to.be.an("array");
|
||||
});
|
||||
it("should return monitor stats with calculated values, docker type", async () => {
|
||||
monitorFindByIdStub.returns(mockMonitorDocker);
|
||||
req.query.sortOrder = "desc";
|
||||
const result = await getMonitorStatsById(req);
|
||||
expect(result).to.include.keys([
|
||||
"_id",
|
||||
"type",
|
||||
"name",
|
||||
"url",
|
||||
"uptimeDuration",
|
||||
"lastChecked",
|
||||
"latestResponseTime",
|
||||
"periodIncidents",
|
||||
"periodTotalChecks",
|
||||
"periodAvgResponseTime",
|
||||
"periodUptime",
|
||||
"aggregateData",
|
||||
]);
|
||||
expect(result.latestResponseTime).to.equal(100);
|
||||
expect(result.periodTotalChecks).to.equal(3);
|
||||
expect(result.periodIncidents).to.equal(1);
|
||||
expect(result.periodUptime).to.be.a("number");
|
||||
expect(result.aggregateData).to.be.an("array");
|
||||
});
|
||||
it("should return monitor stats with calculated values", async () => {
|
||||
req.query.sortOrder = "asc";
|
||||
const result = await getMonitorStatsById(req);
|
||||
|
||||
Reference in New Issue
Block a user