Mock createAikidoEndpointConfigFile in tests

This commit is contained in:
Sander Declerck 2026-05-08 16:42:39 +02:00
parent 5a3df40ee5
commit 38ee7e6f4f
No known key found for this signature in database
2 changed files with 12 additions and 4 deletions

View file

@ -99,9 +99,13 @@ async function startRama(ramaPath, dataFolder, reportingUrl) {
dataFolder, dataFolder,
"--reporting-endpoint", "--reporting-endpoint",
reportingUrl, reportingUrl,
"--config-file",
await createAikidoEndpointConfigFile(dataFolder),
]; ];
const configFile = await createAikidoEndpointConfigFile(dataFolder);
if (configFile) {
args.push("--config-file", configFile);
}
const stdio = getLoggingLevel() === LOGGING_VERBOSE ? "inherit" : "pipe"; const stdio = getLoggingLevel() === LOGGING_VERBOSE ? "inherit" : "pipe";
const process = spawn(ramaPath, args, { stdio: stdio }); const process = spawn(ramaPath, args, { stdio: stdio });

View file

@ -55,11 +55,15 @@ mock.module("../../config/settings.js", {
namedExports: { namedExports: {
getLoggingLevel: mock.fn(() => "default"), getLoggingLevel: mock.fn(() => "default"),
LOGGING_VERBOSE: "verbose", LOGGING_VERBOSE: "verbose",
getMinimumPackageAgeHours: () => 48,
skipMinimumPackageAge: () => false,
}, },
}); });
mock.module("./createAikidoEndpointConfigFile.js", {
namedExports: {
createAikidoEndpointConfigFile: () => "/path/to/config-file.json"
}
})
const mockFetch = mock.method(globalThis, "fetch", async () => ({ const mockFetch = mock.method(globalThis, "fetch", async () => ({
text: async () => "MOCK_CA_CERT_PEM", text: async () => "MOCK_CA_CERT_PEM",
})); }));