Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d
This commit is contained in:
commit
1dfbca08a1
528 files changed
+131054
No files matched your search
@@ -0,0 +1,55 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
|
||||
import type { App } from "../types/appops.ts";
|
||||
import { buildAppFocusSummary, filterAppsByFocus } from "./appFocusView.ts";
|
||||
|
||||
const app = (overrides: Partial<App> = {}): App => ({
|
||||
id: "app-1",
|
||||
name: "Healthy App",
|
||||
category: "Media",
|
||||
status: "healthy",
|
||||
criticality: "low",
|
||||
connectorStatus: "connected",
|
||||
containerStatus: "running",
|
||||
voiceEnabled: false,
|
||||
protected: false,
|
||||
discoveryStatus: "managed",
|
||||
needsReview: false,
|
||||
connector_type: "sonarr",
|
||||
app_type: "media",
|
||||
...overrides,
|
||||
});
|
||||
|
||||
describe("appFocusView", () => {
|
||||
it("summarizes operator attention without counting healthy connected apps as noise", () => {
|
||||
const apps = [
|
||||
app(),
|
||||
app({ id: "review", name: "Review", needsReview: true }),
|
||||
app({ id: "unknown", name: "Unknown", category: "Unknown", app_type: "unknown", connectorStatus: "disconnected" }),
|
||||
app({ id: "missing", name: "Missing Config", connectorStatus: "missing_config" }),
|
||||
app({ id: "unhealthy", name: "Unhealthy", status: "unhealthy" }),
|
||||
];
|
||||
|
||||
const summary = buildAppFocusSummary(apps);
|
||||
|
||||
assert.equal(summary.total, 5);
|
||||
assert.equal(summary.attention, 4);
|
||||
assert.equal(summary.healthyConnected, 1);
|
||||
assert.equal(summary.needsReview, 1);
|
||||
assert.equal(summary.unknown, 1);
|
||||
assert.equal(summary.missingConfig, 1);
|
||||
assert.equal(summary.unhealthy, 1);
|
||||
});
|
||||
|
||||
it("defaults the focus list to actionable apps and keeps all apps available", () => {
|
||||
const apps = [
|
||||
app({ id: "ok" }),
|
||||
app({ id: "needs-review", needsReview: true }),
|
||||
app({ id: "unknown", category: "Unknown", app_type: "unknown", connectorStatus: "disconnected" }),
|
||||
];
|
||||
|
||||
assert.deepEqual(filterAppsByFocus(apps, "attention").map(item => item.id), ["needs-review", "unknown"]);
|
||||
assert.deepEqual(filterAppsByFocus(apps, "all").map(item => item.id), ["ok", "needs-review", "unknown"]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user