From 9e1b526279b2514b7796ac5d1bcefac2f8ec764c Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Oct 2021 13:54:09 +0000 Subject: [PATCH] feat(tests): add test for passing a complete resource to an output --- .../test/__snapshots__/output.test.ts.snap | 29 +++++++++++++++++++ packages/cdktf/test/output.test.ts | 16 ++++++++++ 2 files changed, 45 insertions(+) diff --git a/packages/cdktf/test/__snapshots__/output.test.ts.snap b/packages/cdktf/test/__snapshots__/output.test.ts.snap index f1ef5ed7f2..362158b3c5 100644 --- a/packages/cdktf/test/__snapshots__/output.test.ts.snap +++ b/packages/cdktf/test/__snapshots__/output.test.ts.snap @@ -53,6 +53,35 @@ exports[`description output 1`] = ` }" `; +exports[`full resource output 1`] = ` +"{ + \\"output\\": { + \\"test-output\\": { + \\"value\\": \\"\${test_resource.foo}\\" + } + }, + \\"provider\\": { + \\"test\\": [ + {} + ] + }, + \\"resource\\": { + \\"test_resource\\": { + \\"foo\\": { + \\"name\\": \\"foo\\" + } + } + }, + \\"terraform\\": { + \\"required_providers\\": { + \\"test\\": { + \\"version\\": \\"~> 2.0\\" + } + } + } +}" +`; + exports[`list output 1`] = ` "{ \\"output\\": { diff --git a/packages/cdktf/test/output.test.ts b/packages/cdktf/test/output.test.ts index 00d389ff89..3c62cb51c9 100644 --- a/packages/cdktf/test/output.test.ts +++ b/packages/cdktf/test/output.test.ts @@ -103,3 +103,19 @@ test("variable output", () => { expect(Testing.synth(stack)).toMatchSnapshot(); }); + +test("full resource output", () => { + const app = Testing.app(); + const stack = new TerraformStack(app, "test"); + + new TestProvider(stack, "provider", {}); + const resource = new TestResource(stack, "foo", { + name: "foo", + }); + + new TerraformOutput(stack, "test-output", { + value: resource, + }); + + expect(Testing.synth(stack)).toMatchSnapshot(); +});