Improve mock implementation for foliage model loader in tests
This commit is contained in:
@@ -19,18 +19,25 @@ const loaderState = vi.hoisted(() => ({
|
|||||||
loadCalls: [] as string[]
|
loadCalls: [] as string[]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("../../src/foliage/bundled-foliage-model-loader", () => ({
|
vi.mock("../../src/foliage/bundled-foliage-model-loader", async () => {
|
||||||
loadBundledFoliageModelTemplate: async (bundledPath: string) => {
|
const three = await vi.importActual<typeof import("three")>("three");
|
||||||
loaderState.loadCalls.push(bundledPath);
|
|
||||||
|
|
||||||
const template = new Group();
|
return {
|
||||||
template.add(
|
loadBundledFoliageModelTemplate: async (bundledPath: string) => {
|
||||||
new Mesh(new BoxGeometry(1, 1, 1), new MeshBasicMaterial())
|
loaderState.loadCalls.push(bundledPath);
|
||||||
);
|
|
||||||
|
|
||||||
return template;
|
const template = new three.Group();
|
||||||
}
|
template.add(
|
||||||
}));
|
new three.Mesh(
|
||||||
|
new three.BoxGeometry(1, 1, 1),
|
||||||
|
new three.MeshBasicMaterial()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
import { FoliageInstancedRenderer } from "../../src/foliage/foliage-instanced-renderer";
|
import { FoliageInstancedRenderer } from "../../src/foliage/foliage-instanced-renderer";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user