Skip to content

Commit

Permalink
the power of eunsoo cho
Browse files Browse the repository at this point in the history
  • Loading branch information
joyliu-q committed Oct 22, 2023
1 parent 6a24f6e commit 0e61a27
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 14 additions & 0 deletions cdk/kittyhawk/test/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ test("Deployment -- Default", () => chartTest(buildDeploymentDefault));
test("Container -- Default", () => chartTest(buildContainerDefault));
test("Container -- No Git Sha", () =>
failingTestNoGitSha(buildContainerDefault));

export const failingContainerTestNoGitSha = (_: (scope: Construct) => void) => {
const { GIT_SHA, ...env } = process.env;

process.env = {
...env,
RELEASE_NAME: "RELEASE_NAME",
AWS_ACCOUNT_ID: "TEST_AWS_ACCOUNT_ID",
};

expect(() => {
buildContainerDefault;
}).toThrowError("process.exit: 1");
};
10 changes: 7 additions & 3 deletions cdk/kittyhawk/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ const mockConsoleError = jest.spyOn(console, "error").mockImplementation(() => {
});

export const failingTestNoGitSha = (_: (scope: Construct) => void) => {
process.env.RELEASE_NAME = "RELEASE_NAME";
process.env.GIT_SHA = "";
process.env.AWS_ACCOUNT_ID = "TEST_AWS_ACCOUNT_ID";
const { GIT_SHA, ...env } = process.env;

process.env = {
...env,
RELEASE_NAME: "RELEASE_NAME",
AWS_ACCOUNT_ID: "TEST_AWS_ACCOUNT_ID",
};

expect(() => {
const app = Testing.app();
Expand Down

0 comments on commit 0e61a27

Please sign in to comment.