silverbullet/plug-api/lib/syscall_mock.ts

14 lines
406 B
TypeScript
Raw Normal View History

import { YAML } from "../../lib/deps_server.ts";
2023-07-26 23:12:56 +08:00
2024-07-30 23:24:17 +08:00
// @ts-ignore: syscall is a global function
2023-07-26 23:12:56 +08:00
globalThis.syscall = (name: string, ...args: readonly any[]) => {
switch (name) {
case "yaml.parse":
return Promise.resolve(YAML.parse(args[0]));
case "system.applyAttributeExtractors":
return Promise.resolve({});
2023-07-26 23:12:56 +08:00
default:
throw Error(`Not implemented in tests: ${name}`);
}
};