feat: modernize dashboard widgets
This commit is contained in:
1 parent
1a5e083fd0
commit
6f2cd7fc2b
270 files changed
+10189
-3544
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { aggregateUptimeKumaDashboards } from "./aggregate";
|
||||
|
||||
describe("aggregateUptimeKumaDashboards", () => {
|
||||
it("weights uptime by monitors instead of integrations", () => {
|
||||
const combined = aggregateUptimeKumaDashboards([
|
||||
{
|
||||
totalMonitors: 1,
|
||||
upCount: 1,
|
||||
downCount: 0,
|
||||
pausedCount: 0,
|
||||
averageUptimePercent: 100,
|
||||
monitors: [{ id: 1, name: "one", status: "up", uptimePercent24h: 100 }],
|
||||
},
|
||||
{
|
||||
totalMonitors: 3,
|
||||
upCount: 0,
|
||||
downCount: 3,
|
||||
pausedCount: 0,
|
||||
averageUptimePercent: 0,
|
||||
monitors: [
|
||||
{ id: 2, name: "two", status: "down", uptimePercent24h: 0 },
|
||||
{ id: 3, name: "three", status: "down", uptimePercent24h: 0 },
|
||||
{ id: 4, name: "four", status: "down", uptimePercent24h: 0 },
|
||||
],
|
||||
},
|
||||
]);
|
||||
expect(combined.averageUptimePercent).toBe(25);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user