chore: add tests for schema and API config mocking

- Added unit tests for schema loader, mocking Config variables and resolvers.
- Added unit tests for Zabbix API configuration, verifying constants derived from Config.
- Mocked relevant modules and filesystem behaviors to enable isolated testing.
- Optimized imports on all files and include this within a new .junie/guidelines.md file
This commit is contained in:
Andreas Hilbig 2026-01-28 07:34:08 +01:00
parent 5e41aa5cc4
commit 7adaf82c1b
23 changed files with 204 additions and 110 deletions

View file

@ -0,0 +1,19 @@
// Import after mocking Config
import {ZABBIX_EDGE_DEVICE_BASE_GROUP, zabbixAPI, zabbixSuperAuthToken} from "../datasources/zabbix-api.js";
// Mocking Config
jest.mock("../common_utils.js", () => ({
Config: {
ZABBIX_EDGE_DEVICE_BASE_GROUP: "CustomEdgeGroup",
ZABBIX_AUTH_TOKEN: "super-secret-token",
ZABBIX_BASE_URL: "http://custom-zabbix"
}
}));
describe("Zabbix API Config Mocking", () => {
test("constants are derived from Config", () => {
expect(ZABBIX_EDGE_DEVICE_BASE_GROUP).toBe("CustomEdgeGroup");
expect(zabbixSuperAuthToken).toBe("super-secret-token");
expect(zabbixAPI.baseURL).toBe("http://custom-zabbix");
});
});