Improve mock implementation for foliage model loader in tests

This commit is contained in:
2026-05-03 13:22:50 +02:00
parent 7886f4cfa0
commit eba6392983

View File

@@ -19,18 +19,25 @@ const loaderState = vi.hoisted(() => ({
loadCalls: [] as string[]
}));
vi.mock("../../src/foliage/bundled-foliage-model-loader", () => ({
vi.mock("../../src/foliage/bundled-foliage-model-loader", async () => {
const three = await vi.importActual<typeof import("three")>("three");
return {
loadBundledFoliageModelTemplate: async (bundledPath: string) => {
loaderState.loadCalls.push(bundledPath);
const template = new Group();
const template = new three.Group();
template.add(
new Mesh(new BoxGeometry(1, 1, 1), new MeshBasicMaterial())
new three.Mesh(
new three.BoxGeometry(1, 1, 1),
new three.MeshBasicMaterial()
)
);
return template;
}
}));
};
});
import { FoliageInstancedRenderer } from "../../src/foliage/foliage-instanced-renderer";