Skip to content

Commit

Permalink
feat(tests): add test for passing a complete resource to an output
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarm authored Oct 28, 2021
1 parent cb1b28d commit 9e1b526
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/cdktf/test/__snapshots__/output.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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\\": {
Expand Down
16 changes: 16 additions & 0 deletions packages/cdktf/test/output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

0 comments on commit 9e1b526

Please sign in to comment.