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:
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();
|
||||
|
||||
Reference in new issue
Block a user