feat: expand advanced widget experiences
This commit is contained in:
1 parent
9437d211c8
commit
c099a8eef6
119 files changed
+3624
-844
No files matched your search
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { SpeedtestTrackerDashboardData, SpeedtestTrackerStats } from "@homarr/integrations/types";
|
||||
|
||||
import { combineSpeedtestDashboards, getCompactSections, mergeStats } from "./helpers";
|
||||
import { combineSpeedtestDashboards, getAvailableSpeedtestDashboards, getCompactSections, mergeStats } from "./helpers";
|
||||
|
||||
const stats = (average: number, totalResults: number): SpeedtestTrackerStats => ({
|
||||
ping: { avg: average, min: average, max: average },
|
||||
@@ -27,6 +27,23 @@ describe("speedtest dashboard aggregation", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("speedtest source ownership", () => {
|
||||
it("keeps integration identity when upstream result ids overlap", () => {
|
||||
const result = { id: 1, ping: 1, download_bits: 1, upload_bits: 1, healthy: true, created_at: new Date(1) };
|
||||
const dashboard = { latestResult: result, stats: null, recentResults: [result] };
|
||||
|
||||
expect(
|
||||
getAvailableSpeedtestDashboards([
|
||||
{ integrationId: "speed-a", integrationName: "Speed A", dashboard },
|
||||
{ integrationId: "speed-b", integrationName: "Speed B", dashboard },
|
||||
]).map(({ integrationId, integrationName }) => ({ integrationId, integrationName })),
|
||||
).toEqual([
|
||||
{ integrationId: "speed-a", integrationName: "Speed A" },
|
||||
{ integrationId: "speed-b", integrationName: "Speed B" },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getCompactSections", () => {
|
||||
const available = { latest: true, chart: true, averages: true };
|
||||
|
||||
|
||||
Reference in new issue
Block a user