API: init op_key, improve seralisation & signature typing #1622
@ -11,15 +11,17 @@ faker.option({
|
|||||||
|
|
||||||
const getFakeResponse = (method: OperationNames, data: any) => {
|
const getFakeResponse = (method: OperationNames, data: any) => {
|
||||||
const fakeData = faker.generate(schema.properties[method].properties.return);
|
const fakeData = faker.generate(schema.properties[method].properties.return);
|
||||||
|
const { op_key } = data;
|
||||||
if (method === "open_file") {
|
if (method === "open_file") {
|
||||||
return {
|
return {
|
||||||
status: "success",
|
status: "success",
|
||||||
data: "/path/to/clan",
|
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 };
|
export { getFakeResponse };
|
||||||
|
Loading…
Reference in New Issue
Block a user