API: mock echo op_key

This commit is contained in:
Johannes Kirschbauer 2024-06-15 11:32:42 +02:00
parent cb847cab82
commit 0cf86806b2
Signed by: hsjobeki
SSH Key Fingerprint: SHA256:vX3utDqig7Ph5L0JPv87ZTPb/w7cMzREKVZzzLFg9qU

View File

@ -11,15 +11,17 @@ faker.option({
const getFakeResponse = (method: OperationNames, data: any) => {
const fakeData = faker.generate(schema.properties[method].properties.return);
const { op_key } = data;
if (method === "open_file") {
return {
status: "success",
data: "/path/to/clan",
op_key,
};
}
return fakeData;
// @ts-expect-error: fakeData is guaranteed to always be some object
return { ...fakeData, op_key };
};
export { getFakeResponse };