Skip to content

Commit

Permalink
fix(tests): update convert command unit tests
Browse files Browse the repository at this point in the history
related to #2946
  • Loading branch information
ansgarm committed Jun 23, 2023
1 parent 88a6fd8 commit d1fa87f
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions packages/cdktf-cli/src/test/cmds/convert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ describe("convert command", () => {
`The following providers are missing schema information and might need manual adjustments to synthesize correctly`
);
expect(result.stdout).toContain(
`import * as NullProvider from "./.gen/providers/null";`
);
expect(result.stdout).toContain(
`new NullProvider.resource.Resource(this, "dummy", {});`
`import { Resource } from "./.gen/providers/null/resource";`
);
expect(result.stdout).toContain(`new Resource(this, "dummy", {});`);
});
}, 30_000);
it("reads provider version from existing cdktf.json", async () => {
Expand All @@ -50,11 +48,9 @@ describe("convert command", () => {
`The following providers are missing schema information and might need manual adjustments to synthesize correctly`
);
expect(result.stdout).toContain(
`import * as NullProvider from "./.gen/providers/null";`
);
expect(result.stdout).toContain(
`new NullProvider.resource.Resource(this, "dummy", {});`
`import { Resource } from "./.gen/providers/null/resource";`
);
expect(result.stdout).toContain(`new Resource(this, "dummy", {});`);
});
}, 30_000);
it("works if no cdktf.json could be found", async () => {
Expand All @@ -69,11 +65,9 @@ describe("convert command", () => {
`The following providers are missing schema information and might need manual adjustments to synthesize correctly`
);
expect(result.stdout).toContain(
`import * as NullProvider from "./.gen/providers/null";`
);
expect(result.stdout).toContain(
`new NullProvider.resource.Resource(this, "dummy", {});`
`import { Resource } from "./.gen/providers/null/resource";`
);
expect(result.stdout).toContain(`new Resource(this, "dummy", {});`);
});
}, 30_000);

Expand Down Expand Up @@ -134,11 +128,9 @@ describe("convert command", () => {
`The following providers are missing schema information and might need manual adjustments to synthesize correctly`
);
expect(result.stdout).toContain(
`import * as kubernetes from "./.gen/providers/kubernetes";`
);
expect(result.stdout).toContain(
`new kubernetes.deployment.Deployment(this, "myapp", {`
`import { Deployment } from "./.gen/providers/kubernetes/deployment";`
);
expect(result.stdout).toContain(`new Deployment(this, "myapp", {`);
expect(result.stdout).toContain(`template: {`);
});
}, 30_000);
Expand Down Expand Up @@ -200,11 +192,9 @@ describe("convert command", () => {
`The following providers are missing schema information and might need manual adjustments to synthesize correctly`
);
expect(result.stdout).toContain(
`import * as kubernetes from "./.gen/providers/kubernetes";`
);
expect(result.stdout).toContain(
`new kubernetes.deployment.Deployment(this, "myapp", {`
`import { Deployment } from "./.gen/providers/kubernetes/deployment";`
);
expect(result.stdout).toContain(`new Deployment(this, "myapp", {`);
expect(result.stdout).toContain(`template: {`);
});
}, 30_000);
Expand Down

0 comments on commit d1fa87f

Please sign in to comment.