diff --git a/website/docs/cdktf/test/unit-tests.mdx b/website/docs/cdktf/test/unit-tests.mdx index 89d11ddcc7..5b34adb456 100644 --- a/website/docs/cdktf/test/unit-tests.mdx +++ b/website/docs/cdktf/test/unit-tests.mdx @@ -50,19 +50,19 @@ import MyApplicationsAbstraction from "../app"; // Could be a class extending fr describe("Unit testing using assertions", () => { it("should contain a container", () => { - expect( - Testing.synthScope((scope) => { - new MyApplicationsAbstraction(scope, "my-app", {}); - }) - ).toHaveResource(Container); + const app = Testing.app(); + const stack = new MyApplicationsAbstraction(app, "my-app", {}); + const synthesized = Testing.synth(stack); + + expect(synthesized).toHaveResource(Container); }); it("should use an ubuntu image", () => { - expect( - Testing.synthScope((scope) => { - new MyApplicationsAbstraction(scope, "my-app", {}); - }) - ).toHaveResourceWithProperties(Image, { name: "ubuntu:latest" }); + const app = Testing.app(); + const stack = new MyApplicationsAbstraction(app, "my-app", {}); + const synthesized = Testing.synth(stack); + + expect(synthesized).toHaveResourceWithProperties(Image, { name: "ubuntu:latest" }); }); }); ```