Skip to content

Commit

Permalink
add : rendering test
Browse files Browse the repository at this point in the history
  • Loading branch information
MasatoMakino committed Jun 26, 2024
1 parent 26b0eb3 commit ac3cb9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions __test__/postprocess/PassRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ export const renderingPass = (message: string, pass: PostProcessShaderPass) => {
composer.onAfterRender = vi.fn();
composer.onBeforeRender = vi.fn();

const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});

renderer.render(0);
expect(composer.onAfterRender, message).toBeCalled();
expect(composer.onBeforeRender, message).toBeCalled();
expect(
errorSpy,
message + " : The compilation of the fragmentShader",
).not.toBeCalled();

errorSpy.mockRestore();
};
4 changes: 3 additions & 1 deletion __test__/postprocess/PostProcessShaderPass.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { Texture } from "three";

describe("PostProcessShaderPass", () => {
it("should correctly instantiate PostProcessShaderPass with default properties", () => {
const pass = new PostProcessShaderPass(new PostProcessShader());
const shader = new PostProcessShader();
shader.fragmentShader = "";
const pass = new PostProcessShaderPass(shader);

expect(pass).toBeInstanceOf(PostProcessShaderPass);
expect(pass.uniforms).toBeDefined();
Expand Down

0 comments on commit ac3cb9c

Please sign in to comment.