mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Mock createAikidoEndpointConfigFile in tests
This commit is contained in:
parent
5a3df40ee5
commit
38ee7e6f4f
2 changed files with 12 additions and 4 deletions
|
|
@ -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 });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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",
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue