-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
stephengeller
committed
Mar 22, 2021
1 parent
6ad6a37
commit d4ce39c
Showing
8 changed files
with
19,706 additions
and
81 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
* The reason for this file is to appease the tests in `core/ssm.test.ts`. | ||
* We don't need this to contain anything useful because we're not testing the contents of it within that testing suite. | ||
* */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../runtime/lambda.ts |
17 changes: 17 additions & 0 deletions
17
src/constructs/core/custom-resources/runtime/lambda.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* You can't specify the file extension (eg .ts) of the file to import, | ||
* and lambda.js exists as a dummy file, so we'd always import that over lambda.ts (the actual code to be tested) if | ||
* we imported `lambda` | ||
* lambda.symlink is a symlink to lambda.ts, so we can test it without importing lambda.js | ||
* */ | ||
import { flatten } from "./lambda.symlink"; | ||
|
||
describe("The flatten function", function () { | ||
it("should flatten nested objects into one", function () { | ||
expect(flatten({ foo: { bar: "baz" } })).toEqual({ "foo.bar": "baz" }); | ||
}); | ||
|
||
it("should flatten infinitely nested objects into one", function () { | ||
expect(flatten({ foo: { bar: { baz: { blah: "foo" } } } })).toEqual({ "foo.bar.baz.blah": "foo" }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import "@aws-cdk/assert/jest"; | ||
import { simpleGuStackForTesting } from "../../../test/utils"; | ||
import { GuSSMIdentityParameter, GuSSMParameter } from "./ssm"; | ||
|
||
describe("SSM:", () => { | ||
describe("The GuSSMIdentityParameter construct", () => { | ||
beforeAll(() => { | ||
// TODO: Experiment with compiling `custom-resources/runtime/lambda.ts` to JS so that tests run | ||
}); | ||
|
||
it("requires the scope and parameter name", function () { | ||
const stack = simpleGuStackForTesting({ stack: "some-stack" }); | ||
const param = new GuSSMIdentityParameter(stack, { parameter: "some-param", app: "foo" }); | ||
expect(stack).toHaveResourceLike("Custom::GuGetSSMParameter", { | ||
getParamsProps: { | ||
"Fn::Join": ["", ['{"apiRequest":{"Name":"/', { Ref: "Stage" }, '/some-stack/foo/some-param"}}']], | ||
}, | ||
}); | ||
expect(param.getValue()).toMatch(/TOKEN/i); | ||
}); | ||
}); | ||
|
||
describe("The GuSSMParameter construct", () => { | ||
it("requires the scope and parameter name", function () { | ||
const stack = simpleGuStackForTesting({ stack: "some-stack" }); | ||
const param = new GuSSMParameter(stack, { parameter: "/path/to/some-param" }); | ||
expect(stack).toHaveResourceLike("Custom::GuGetSSMParameter", { | ||
getParamsProps: '{"apiRequest":{"Name":"/path/to/some-param"}}', | ||
}); | ||
expect(param.getValue()).toMatch(/TOKEN/i); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters