fix: narrow possibly undefined system in beszel test

TypeScript reports 'system' is possibly undefined since it comes from
array indexing. Replace expect().toBeDefined() with an explicit throw
guard so the type narrows for subsequent property accesses.
This commit is contained in:
Thomas Camlong committed 2026-06-08 23:57:44 +02:00
1 parent 27521a6cfd
commit 79b3e5cc18
1 file changed
+4 -2
@@ -75,8 +75,10 @@ describe.skipIf(!shouldRun)("BeszelIntegration (real instance)", () => {
test("each system has required fields", async () => {
const systems = await integration.getSystemsAsync();
const system = systems[0];
expect(system).toBeDefined();
systemId = system?.id ?? "";
if (!system) {
throw new Error("Expected at least one system");
}
systemId = system.id;
expect(system.id).toBeDefined();
expect(system.name).toBeDefined();