Add Extension tests (#2125)

* Add test for extension hooks
Add afterConfigureGraph callback

* fix comment
This commit is contained in:
pythongosssss
2023-12-01 22:24:20 +00:00
committed by GitHub
parent ec7a00aa96
commit 8491280504
3 changed files with 201 additions and 3 deletions

View File

@@ -4,11 +4,11 @@ const lg = require("./litegraph");
/**
*
* @param { Parameters<mockApi>[0] & { resetEnv?: boolean } } config
* @param { Parameters<mockApi>[0] & { resetEnv?: boolean, preSetup?(app): Promise<void> } } config
* @returns
*/
export async function start(config = undefined) {
if(config?.resetEnv) {
export async function start(config = {}) {
if(config.resetEnv) {
jest.resetModules();
jest.resetAllMocks();
lg.setup(global);
@@ -16,6 +16,7 @@ export async function start(config = undefined) {
mockApi(config);
const { app } = require("../../web/scripts/app");
config.preSetup?.(app);
await app.setup();
return { ...Ez.graph(app, global["LiteGraph"], global["LGraphCanvas"]), app };
}