Open
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
cdktf & Language Versions
cdktf 0.11.0 (type-script)
Affected Resource(s)
Unit tests not working like I would expect. Could be me though :)
Debug Output
N/A
Expected Behavior
Test should pass unless I'm doing something wrong.
Actual Behavior
> [email protected] test
> jest
FAIL __tests__/main-test.ts (9.099 s)
● Configuration › should contain an application
Expected azuread_application with properties {} to be present in synthesised stack.
Found no azuread_application resources instead
28 | new PortalStack(scope, 'test');
29 | })
> 30 | ).toHaveResource(Application);
| ^
31 | });
at Object.<anonymous> (__tests__/main-test.ts:30:7)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 0 todo, 0 passed, 1 total
Snapshots: 0 total
Time: 4.642 s
Steps to Reproduce
import "cdktf/lib/testing/adapters/jest";
import { Testing } from "cdktf";
import { PortalStack } from "../main";
import { Application } from "@cdktf/provider-azuread";
describe("Configuration", () => {
it("should contain an application", () => {
expect(
Testing.synthScope((scope) => {
new PortalStack(scope, 'test');
})
).toHaveResource(Application);
});
});
Important Factoids
cdktf synth/diff/deploy
work perfectly finecdk.tf.json
undercdktf.out
contains the following:
[
[...]
"resource": {
"azuread_application": {
"xxxauthportal_portalapp_3876DFED": {
"//": {
"metadata": {
[...]
]
References (main.ts)
import { Construct } from "constructs";
import {
App,
TerraformStack,
RemoteBackend,
} from "cdktf";
import {
AzureadProvider,
ApplicationFeatureTags,
Application,
} from "./.gen/providers/azuread";
export class PortalStack extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
new AzureadProvider(this, "AzureAd", {});
this.AzureAdApp();
}
AzureAdApp(this: PortalStack) {
const samlIdUri = "";
const samlReplyUrl = "";
const samlLogoutUrl = "";
const appFeatureTags: ApplicationFeatureTags = {
enterprise: true,
};
new Application(this, "portal_app", {
displayName: `AuthPortal`,
featureTags: [appFeatureTags],
identifierUris: [samlIdUri],
web: {
redirectUris: [samlReplyUrl],
logoutUrl: samlLogoutUrl,
},
preventDuplicateNames: true,
});
}
}
const app = new App();
const stack = new PortalStack(app, "auth-portal");
new RemoteBackend(stack, {
hostname: "app.terraform.io",
organization: "xxx",
workspaces: {
name: `auth-portal`,
}
});
app.synth();