From abbd7f4fda2d169365d5ef3ae20f8fb8445e690f Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Wed, 30 Apr 2025 17:19:53 +0100 Subject: [PATCH] fix: Correct assertions in config.test.js case 1 --- server/tests/config.test.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/server/tests/config.test.js b/server/tests/config.test.js index 38985402e..349b249c6 100644 --- a/server/tests/config.test.js +++ b/server/tests/config.test.js @@ -69,11 +69,23 @@ describe('Configuration Loading (loadConfiguration)', () => { PROXMOX_TOKEN_ID: 'user@pam!pve', PROXMOX_TOKEN_SECRET: 'secretpve', }); - const { config, errors } = loadConfiguration(); - expect(errors).toHaveLength(0); - expect(config.pve.host).toBe('pve.example.com'); - expect(config.pve.tokenId).toBe('user@pam!pve'); - expect(config.pve.tokenSecret).toBe('secretpve'); + // Expect no error to be thrown for valid config + let loadedConfig; + expect(() => { + loadedConfig = loadConfiguration(); + }).not.toThrow(); + + // Check the returned structure + expect(loadedConfig).toBeDefined(); + expect(loadedConfig.endpoints).toHaveLength(1); // Check endpoints array + expect(loadedConfig.pbsConfigs).toHaveLength(0); // Expect no PBS configs + + // Check the primary PVE endpoint details within the endpoints array + const primaryEndpoint = loadedConfig.endpoints[0]; + expect(primaryEndpoint.id).toBe('primary'); + expect(primaryEndpoint.host).toBe('pve.example.com'); + expect(primaryEndpoint.tokenId).toBe('user@pam!pve'); + expect(primaryEndpoint.tokenSecret).toBe('secretpve'); }); // Test Case 2: Missing Primary Proxmox Variables