/
ec2.test.ts
40 lines (32 loc) · 1.23 KB
/
ec2.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert/lib/synth-utils";
import { simpleGuStackForTesting } from "../../../utils/test";
import { GuInstanceTypeParameter } from "./ec2";
import type { SynthedStack } from "../../../utils/test";
describe("The GuInstanceTypeParameter class", () => {
it("should combine default, override and prop values", () => {
const stack = simpleGuStackForTesting();
new GuInstanceTypeParameter(stack, { allowedValues: ["t3.small"], app: "testing" });
const json = SynthUtils.toCloudFormation(stack) as SynthedStack;
expect(json.Parameters[`InstanceTypeTesting`]).toEqual({
Type: "String",
Description: "EC2 Instance Type for the app testing",
Default: "t3.small",
AllowedValues: ["t3.small"],
});
});
it("let's you override the default values", () => {
const stack = simpleGuStackForTesting();
new GuInstanceTypeParameter(stack, {
description: "This is a test",
default: 1,
app: "testing",
});
const json = SynthUtils.toCloudFormation(stack) as SynthedStack;
expect(json.Parameters["InstanceTypeTesting"]).toEqual({
Type: "String",
Description: "This is a test",
Default: 1,
});
});
});