cdk-serverless 2.18.0 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -72,6 +72,106 @@ const api = new TestApiRestApi(this, 'Api', {
72
72
 
73
73
  This will also create Lambda functions for all operations defined in your spec and wire them accordingly.
74
74
 
75
+ ## Testing Utilities
76
+
77
+ CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.
78
+
79
+ ### LambdaTestUtil
80
+
81
+ The `LambdaTestUtil` provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.
82
+
83
+ #### REST API Testing
84
+
85
+ ```typescript
86
+ import { LambdaRestUnitTest } from 'cdk-serverless/tests/lambda-test-utils';
87
+
88
+ const test = new LambdaRestUnitTest(handler, {
89
+ // Optional default headers for all requests
90
+ headers: {
91
+ 'Content-Type': 'application/json',
92
+ },
93
+ // Optional default Cognito user for all requests
94
+ cognito: {
95
+ username: 'test-user',
96
+ email: 'test@example.com',
97
+ groups: ['admin'],
98
+ },
99
+ });
100
+
101
+ // Test a GET request
102
+ const result = await test.call({
103
+ path: '/items',
104
+ method: 'GET',
105
+ });
106
+
107
+ // Test a POST request with body
108
+ const result = await test.call({
109
+ path: '/items',
110
+ method: 'POST',
111
+ body: JSON.stringify({ name: 'test' }),
112
+ });
113
+ ```
114
+
115
+ #### GraphQL Testing
116
+
117
+ ```typescript
118
+ import { LambdaGraphQLTest } from 'cdk-serverless/tests/lambda-test-utils';
119
+
120
+ const test = new LambdaGraphQLTest(handler, {
121
+ // Optional default Cognito user for all requests
122
+ cognito: {
123
+ username: 'test-user',
124
+ email: 'test@example.com',
125
+ groups: ['admin'],
126
+ },
127
+ });
128
+
129
+ // Test a GraphQL query
130
+ const result = await test.call({
131
+ fieldName: 'getItem',
132
+ arguments: { id: '123' },
133
+ });
134
+ ```
135
+
136
+ ### IntegTestUtil
137
+
138
+ The `IntegTestUtil` provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.
139
+
140
+ ```typescript
141
+ import { IntegTestUtil } from 'cdk-serverless/tests/integ-test-util';
142
+
143
+ // Initialize with your stack outputs
144
+ const test = new IntegTestUtil({
145
+ region: 'us-east-1',
146
+ apiOptions: {
147
+ baseURL: 'https://api.example.com',
148
+ },
149
+ authOptions: {
150
+ userPoolId: 'us-east-1_xxxxx',
151
+ userPoolClientId: 'xxxxxxxx',
152
+ identityPoolId: 'us-east-1:xxxxxxxx',
153
+ },
154
+ datastoreOptions: {
155
+ tableName: 'MyTable',
156
+ },
157
+ });
158
+
159
+ // Create and authenticate a test user
160
+ await test.createUser('test@example.com', {
161
+ 'custom:attribute': 'value',
162
+ }, ['admin']);
163
+
164
+ // Get an authenticated API client
165
+ const client = await test.getAuthenticatedClient('test@example.com');
166
+
167
+ // Make API calls
168
+ const response = await client.get('/items');
169
+
170
+ // Clean up test data
171
+ await test.cleanupItems();
172
+ await test.removeUser('test@example.com');
173
+ ```
174
+
75
175
  ## Contribute
76
176
 
77
177
  ### How to contribute to CDK Serverless
@@ -33,6 +33,18 @@
33
33
  </code><button type="button">Copy</button></pre>
34
34
 
35
35
  <p>This will also create Lambda functions for all operations defined in your spec and wire them accordingly.</p>
36
+ <a id="testing-utilities" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Testing Utilities<a href="#testing-utilities" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.</p>
37
+ <a id="lambdatestutil" class="tsd-anchor"></a><h3 class="tsd-anchor-link">LambdaTestUtil<a href="#lambdatestutil" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The <code>LambdaTestUtil</code> provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.</p>
38
+ <a id="rest-api-testing" class="tsd-anchor"></a><h4 class="tsd-anchor-link">REST API Testing<a href="#rest-api-testing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">LambdaRestUnitTest</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/lambda-test-utils&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">LambdaRestUnitTest</span><span class="hl-1">(</span><span class="hl-4">handler</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default headers for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">headers:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-2">&#39;Content-Type&#39;</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-2">&#39;application/json&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default Cognito user for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">cognito:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">username:</span><span class="hl-1"> </span><span class="hl-2">&#39;test-user&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">email:</span><span class="hl-1"> </span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">groups:</span><span class="hl-1"> [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">],</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a GET request</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">path:</span><span class="hl-1"> </span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">method:</span><span class="hl-1"> </span><span class="hl-2">&#39;GET&#39;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a POST request with body</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">path:</span><span class="hl-1"> </span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">method:</span><span class="hl-1"> </span><span class="hl-2">&#39;POST&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">body:</span><span class="hl-1"> </span><span class="hl-7">JSON</span><span class="hl-1">.</span><span class="hl-0">stringify</span><span class="hl-1">({ </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-2">&#39;test&#39;</span><span class="hl-1"> }),</span><br/><span class="hl-1">});</span>
39
+ </code><button type="button">Copy</button></pre>
40
+
41
+ <a id="graphql-testing" class="tsd-anchor"></a><h4 class="tsd-anchor-link">GraphQL Testing<a href="#graphql-testing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">LambdaGraphQLTest</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/lambda-test-utils&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">LambdaGraphQLTest</span><span class="hl-1">(</span><span class="hl-4">handler</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default Cognito user for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">cognito:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">username:</span><span class="hl-1"> </span><span class="hl-2">&#39;test-user&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">email:</span><span class="hl-1"> </span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">groups:</span><span class="hl-1"> [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">],</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a GraphQL query</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">fieldName:</span><span class="hl-1"> </span><span class="hl-2">&#39;getItem&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">arguments:</span><span class="hl-1"> { </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">&#39;123&#39;</span><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
42
+ </code><button type="button">Copy</button></pre>
43
+
44
+ <a id="integtestutil" class="tsd-anchor"></a><h3 class="tsd-anchor-link">IntegTestUtil<a href="#integtestutil" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The <code>IntegTestUtil</code> provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.</p>
45
+ <pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">IntegTestUtil</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/integ-test-util&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// Initialize with your stack outputs</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">IntegTestUtil</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">region:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">apiOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">baseURL:</span><span class="hl-1"> </span><span class="hl-2">&#39;https://api.example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">authOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">userPoolId:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1_xxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">userPoolClientId:</span><span class="hl-1"> </span><span class="hl-2">&#39;xxxxxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">identityPoolId:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1:xxxxxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">datastoreOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">tableName:</span><span class="hl-1"> </span><span class="hl-2">&#39;MyTable&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Create and authenticate a test user</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">createUser</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-2">&#39;custom:attribute&#39;</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-2">&#39;value&#39;</span><span class="hl-1">,</span><br/><span class="hl-1">}, [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">]);</span><br/><br/><span class="hl-6">// Get an authenticated API client</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">client</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">getAuthenticatedClient</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Make API calls</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">response</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1">.</span><span class="hl-0">get</span><span class="hl-1">(</span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Clean up test data</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">cleanupItems</span><span class="hl-1">();</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">removeUser</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">);</span>
46
+ </code><button type="button">Copy</button></pre>
47
+
36
48
  <a id="contribute" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Contribute<a href="#contribute" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="how-to-contribute-to-cdk-serverless" class="tsd-anchor"></a><h3 class="tsd-anchor-link">How to contribute to CDK Serverless<a href="#how-to-contribute-to-cdk-serverless" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><a id="did-you-find-a-bug" class="tsd-anchor"></a><h4 class="tsd-anchor-link"><strong>Did you find a bug?</strong><a href="#did-you-find-a-bug" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><ul>
37
49
  <li>
38
50
  <p><strong>Ensure the bug was not already reported</strong> by searching on GitHub under <a href="https://github.com/taimos/cdk-serverless/issues">Issues</a>.</p>
@@ -62,4 +74,4 @@
62
74
  <li>Just file a PR with your recommended changes</li>
63
75
  </ul>
64
76
  <a id="authors" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Authors<a href="#authors" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Brought to you by <a href="https://taimos.de">Taimos</a></p>
65
- </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#cdk-serverless"><span>CDK <wbr/>Serverless</span></a><ul><li><ul><li><a href="#features"><span>Features</span></a></li></ul></li><li><a href="#quick-start"><span>Quick <wbr/>Start</span></a></li><li><ul><li><a href="#adding-projen-constructs"><span>Adding projen constructs</span></a></li><li><a href="#using-the-cdk-serverless-l3-constructs"><span>Using the CDK serverless <wbr/>L3 constructs</span></a></li></ul></li><li><a href="#contribute"><span>Contribute</span></a></li><li><ul><li><a href="#how-to-contribute-to-cdk-serverless"><span>How to contribute to CDK <wbr/>Serverless</span></a></li><li><ul><li><a href="#did-you-find-a-bug"><span>Did you find a bug?</span></a></li><li><a href="#did-you-write-a-patch-that-fixes-a-bug"><span>Did you write a patch that fixes a bug?</span></a></li><li><a href="#did-you-fix-whitespace-format-code-or-make-a-purely-cosmetic-patch"><span>Did you fix whitespace, format code, or make a purely cosmetic patch?</span></a></li><li><a href="#do-you-intend-to-add-a-new-feature-or-change-an-existing-one"><span>Do you intend to add a new feature or change an existing one?</span></a></li><li><a href="#do-you-want-to-contribute-to-the-cdk-serverless-documentation"><span>Do you want to contribute to the CDK <wbr/>Serverless documentation?</span></a></li></ul></li></ul></li><li><a href="#authors"><span>Authors</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">cdk-serverless</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
77
+ </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#cdk-serverless"><span>CDK <wbr/>Serverless</span></a><ul><li><ul><li><a href="#features"><span>Features</span></a></li></ul></li><li><a href="#quick-start"><span>Quick <wbr/>Start</span></a></li><li><ul><li><a href="#adding-projen-constructs"><span>Adding projen constructs</span></a></li><li><a href="#using-the-cdk-serverless-l3-constructs"><span>Using the CDK serverless <wbr/>L3 constructs</span></a></li></ul></li><li><a href="#testing-utilities"><span>Testing <wbr/>Utilities</span></a></li><li><ul><li><a href="#lambdatestutil"><span>Lambda<wbr/>Test<wbr/>Util</span></a></li><li><ul><li><a href="#rest-api-testing"><span>REST API <wbr/>Testing</span></a></li><li><a href="#graphql-testing"><span>GraphQL <wbr/>Testing</span></a></li></ul></li><li><a href="#integtestutil"><span>Integ<wbr/>Test<wbr/>Util</span></a></li></ul></li><li><a href="#contribute"><span>Contribute</span></a></li><li><ul><li><a href="#how-to-contribute-to-cdk-serverless"><span>How to contribute to CDK <wbr/>Serverless</span></a></li><li><ul><li><a href="#did-you-find-a-bug"><span>Did you find a bug?</span></a></li><li><a href="#did-you-write-a-patch-that-fixes-a-bug"><span>Did you write a patch that fixes a bug?</span></a></li><li><a href="#did-you-fix-whitespace-format-code-or-make-a-purely-cosmetic-patch"><span>Did you fix whitespace, format code, or make a purely cosmetic patch?</span></a></li><li><a href="#do-you-intend-to-add-a-new-feature-or-change-an-existing-one"><span>Do you intend to add a new feature or change an existing one?</span></a></li><li><a href="#do-you-want-to-contribute-to-the-cdk-serverless-documentation"><span>Do you want to contribute to the CDK <wbr/>Serverless documentation?</span></a></li></ul></li></ul></li><li><a href="#authors"><span>Authors</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">cdk-serverless</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -33,6 +33,18 @@
33
33
  </code><button type="button">Copy</button></pre>
34
34
 
35
35
  <p>This will also create Lambda functions for all operations defined in your spec and wire them accordingly.</p>
36
+ <a id="testing-utilities" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Testing Utilities<a href="#testing-utilities" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.</p>
37
+ <a id="lambdatestutil" class="tsd-anchor"></a><h3 class="tsd-anchor-link">LambdaTestUtil<a href="#lambdatestutil" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The <code>LambdaTestUtil</code> provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.</p>
38
+ <a id="rest-api-testing" class="tsd-anchor"></a><h4 class="tsd-anchor-link">REST API Testing<a href="#rest-api-testing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">LambdaRestUnitTest</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/lambda-test-utils&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">LambdaRestUnitTest</span><span class="hl-1">(</span><span class="hl-4">handler</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default headers for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">headers:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-2">&#39;Content-Type&#39;</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-2">&#39;application/json&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default Cognito user for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">cognito:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">username:</span><span class="hl-1"> </span><span class="hl-2">&#39;test-user&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">email:</span><span class="hl-1"> </span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">groups:</span><span class="hl-1"> [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">],</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a GET request</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">path:</span><span class="hl-1"> </span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">method:</span><span class="hl-1"> </span><span class="hl-2">&#39;GET&#39;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a POST request with body</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">path:</span><span class="hl-1"> </span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">method:</span><span class="hl-1"> </span><span class="hl-2">&#39;POST&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">body:</span><span class="hl-1"> </span><span class="hl-7">JSON</span><span class="hl-1">.</span><span class="hl-0">stringify</span><span class="hl-1">({ </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-2">&#39;test&#39;</span><span class="hl-1"> }),</span><br/><span class="hl-1">});</span>
39
+ </code><button type="button">Copy</button></pre>
40
+
41
+ <a id="graphql-testing" class="tsd-anchor"></a><h4 class="tsd-anchor-link">GraphQL Testing<a href="#graphql-testing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">LambdaGraphQLTest</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/lambda-test-utils&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">LambdaGraphQLTest</span><span class="hl-1">(</span><span class="hl-4">handler</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default Cognito user for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">cognito:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">username:</span><span class="hl-1"> </span><span class="hl-2">&#39;test-user&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">email:</span><span class="hl-1"> </span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">groups:</span><span class="hl-1"> [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">],</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a GraphQL query</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">fieldName:</span><span class="hl-1"> </span><span class="hl-2">&#39;getItem&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">arguments:</span><span class="hl-1"> { </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">&#39;123&#39;</span><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
42
+ </code><button type="button">Copy</button></pre>
43
+
44
+ <a id="integtestutil" class="tsd-anchor"></a><h3 class="tsd-anchor-link">IntegTestUtil<a href="#integtestutil" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The <code>IntegTestUtil</code> provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.</p>
45
+ <pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">IntegTestUtil</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/integ-test-util&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// Initialize with your stack outputs</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">IntegTestUtil</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">region:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">apiOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">baseURL:</span><span class="hl-1"> </span><span class="hl-2">&#39;https://api.example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">authOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">userPoolId:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1_xxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">userPoolClientId:</span><span class="hl-1"> </span><span class="hl-2">&#39;xxxxxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">identityPoolId:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1:xxxxxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">datastoreOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">tableName:</span><span class="hl-1"> </span><span class="hl-2">&#39;MyTable&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Create and authenticate a test user</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">createUser</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-2">&#39;custom:attribute&#39;</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-2">&#39;value&#39;</span><span class="hl-1">,</span><br/><span class="hl-1">}, [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">]);</span><br/><br/><span class="hl-6">// Get an authenticated API client</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">client</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">getAuthenticatedClient</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Make API calls</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">response</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1">.</span><span class="hl-0">get</span><span class="hl-1">(</span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Clean up test data</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">cleanupItems</span><span class="hl-1">();</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">removeUser</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">);</span>
46
+ </code><button type="button">Copy</button></pre>
47
+
36
48
  <a id="contribute" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Contribute<a href="#contribute" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="how-to-contribute-to-cdk-serverless" class="tsd-anchor"></a><h3 class="tsd-anchor-link">How to contribute to CDK Serverless<a href="#how-to-contribute-to-cdk-serverless" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><a id="did-you-find-a-bug" class="tsd-anchor"></a><h4 class="tsd-anchor-link"><strong>Did you find a bug?</strong><a href="#did-you-find-a-bug" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><ul>
37
49
  <li>
38
50
  <p><strong>Ensure the bug was not already reported</strong> by searching on GitHub under <a href="https://github.com/taimos/cdk-serverless/issues">Issues</a>.</p>
@@ -62,4 +74,4 @@
62
74
  <li>Just file a PR with your recommended changes</li>
63
75
  </ul>
64
76
  <a id="authors" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Authors<a href="#authors" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Brought to you by <a href="https://taimos.de">Taimos</a></p>
65
- </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#cdk-serverless"><span>CDK <wbr/>Serverless</span></a><ul><li><ul><li><a href="#features"><span>Features</span></a></li></ul></li><li><a href="#quick-start"><span>Quick <wbr/>Start</span></a></li><li><ul><li><a href="#adding-projen-constructs"><span>Adding projen constructs</span></a></li><li><a href="#using-the-cdk-serverless-l3-constructs"><span>Using the CDK serverless <wbr/>L3 constructs</span></a></li></ul></li><li><a href="#contribute"><span>Contribute</span></a></li><li><ul><li><a href="#how-to-contribute-to-cdk-serverless"><span>How to contribute to CDK <wbr/>Serverless</span></a></li><li><ul><li><a href="#did-you-find-a-bug"><span>Did you find a bug?</span></a></li><li><a href="#did-you-write-a-patch-that-fixes-a-bug"><span>Did you write a patch that fixes a bug?</span></a></li><li><a href="#did-you-fix-whitespace-format-code-or-make-a-purely-cosmetic-patch"><span>Did you fix whitespace, format code, or make a purely cosmetic patch?</span></a></li><li><a href="#do-you-intend-to-add-a-new-feature-or-change-an-existing-one"><span>Do you intend to add a new feature or change an existing one?</span></a></li><li><a href="#do-you-want-to-contribute-to-the-cdk-serverless-documentation"><span>Do you want to contribute to the CDK <wbr/>Serverless documentation?</span></a></li></ul></li></ul></li><li><a href="#authors"><span>Authors</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">cdk-serverless</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
77
+ </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#cdk-serverless"><span>CDK <wbr/>Serverless</span></a><ul><li><ul><li><a href="#features"><span>Features</span></a></li></ul></li><li><a href="#quick-start"><span>Quick <wbr/>Start</span></a></li><li><ul><li><a href="#adding-projen-constructs"><span>Adding projen constructs</span></a></li><li><a href="#using-the-cdk-serverless-l3-constructs"><span>Using the CDK serverless <wbr/>L3 constructs</span></a></li></ul></li><li><a href="#testing-utilities"><span>Testing <wbr/>Utilities</span></a></li><li><ul><li><a href="#lambdatestutil"><span>Lambda<wbr/>Test<wbr/>Util</span></a></li><li><ul><li><a href="#rest-api-testing"><span>REST API <wbr/>Testing</span></a></li><li><a href="#graphql-testing"><span>GraphQL <wbr/>Testing</span></a></li></ul></li><li><a href="#integtestutil"><span>Integ<wbr/>Test<wbr/>Util</span></a></li></ul></li><li><a href="#contribute"><span>Contribute</span></a></li><li><ul><li><a href="#how-to-contribute-to-cdk-serverless"><span>How to contribute to CDK <wbr/>Serverless</span></a></li><li><ul><li><a href="#did-you-find-a-bug"><span>Did you find a bug?</span></a></li><li><a href="#did-you-write-a-patch-that-fixes-a-bug"><span>Did you write a patch that fixes a bug?</span></a></li><li><a href="#did-you-fix-whitespace-format-code-or-make-a-purely-cosmetic-patch"><span>Did you fix whitespace, format code, or make a purely cosmetic patch?</span></a></li><li><a href="#do-you-intend-to-add-a-new-feature-or-change-an-existing-one"><span>Do you intend to add a new feature or change an existing one?</span></a></li><li><a href="#do-you-want-to-contribute-to-the-cdk-serverless-documentation"><span>Do you want to contribute to the CDK <wbr/>Serverless documentation?</span></a></li></ul></li></ul></li><li><a href="#authors"><span>Authors</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">cdk-serverless</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -33,6 +33,18 @@
33
33
  </code><button type="button">Copy</button></pre>
34
34
 
35
35
  <p>This will also create Lambda functions for all operations defined in your spec and wire them accordingly.</p>
36
+ <a id="testing-utilities" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Testing Utilities<a href="#testing-utilities" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.</p>
37
+ <a id="lambdatestutil" class="tsd-anchor"></a><h3 class="tsd-anchor-link">LambdaTestUtil<a href="#lambdatestutil" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The <code>LambdaTestUtil</code> provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.</p>
38
+ <a id="rest-api-testing" class="tsd-anchor"></a><h4 class="tsd-anchor-link">REST API Testing<a href="#rest-api-testing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">LambdaRestUnitTest</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/lambda-test-utils&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">LambdaRestUnitTest</span><span class="hl-1">(</span><span class="hl-4">handler</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default headers for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">headers:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-2">&#39;Content-Type&#39;</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-2">&#39;application/json&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default Cognito user for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">cognito:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">username:</span><span class="hl-1"> </span><span class="hl-2">&#39;test-user&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">email:</span><span class="hl-1"> </span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">groups:</span><span class="hl-1"> [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">],</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a GET request</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">path:</span><span class="hl-1"> </span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">method:</span><span class="hl-1"> </span><span class="hl-2">&#39;GET&#39;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a POST request with body</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">path:</span><span class="hl-1"> </span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">method:</span><span class="hl-1"> </span><span class="hl-2">&#39;POST&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">body:</span><span class="hl-1"> </span><span class="hl-7">JSON</span><span class="hl-1">.</span><span class="hl-0">stringify</span><span class="hl-1">({ </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-2">&#39;test&#39;</span><span class="hl-1"> }),</span><br/><span class="hl-1">});</span>
39
+ </code><button type="button">Copy</button></pre>
40
+
41
+ <a id="graphql-testing" class="tsd-anchor"></a><h4 class="tsd-anchor-link">GraphQL Testing<a href="#graphql-testing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">LambdaGraphQLTest</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/lambda-test-utils&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">LambdaGraphQLTest</span><span class="hl-1">(</span><span class="hl-4">handler</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-6">// Optional default Cognito user for all requests</span><br/><span class="hl-1"> </span><span class="hl-4">cognito:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">username:</span><span class="hl-1"> </span><span class="hl-2">&#39;test-user&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">email:</span><span class="hl-1"> </span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">groups:</span><span class="hl-1"> [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">],</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Test a GraphQL query</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">result</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">call</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">fieldName:</span><span class="hl-1"> </span><span class="hl-2">&#39;getItem&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">arguments:</span><span class="hl-1"> { </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">&#39;123&#39;</span><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
42
+ </code><button type="button">Copy</button></pre>
43
+
44
+ <a id="integtestutil" class="tsd-anchor"></a><h3 class="tsd-anchor-link">IntegTestUtil<a href="#integtestutil" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The <code>IntegTestUtil</code> provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.</p>
45
+ <pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">IntegTestUtil</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cdk-serverless/tests/integ-test-util&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// Initialize with your stack outputs</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">test</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">IntegTestUtil</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">region:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">apiOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">baseURL:</span><span class="hl-1"> </span><span class="hl-2">&#39;https://api.example.com&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">authOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">userPoolId:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1_xxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">userPoolClientId:</span><span class="hl-1"> </span><span class="hl-2">&#39;xxxxxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">identityPoolId:</span><span class="hl-1"> </span><span class="hl-2">&#39;us-east-1:xxxxxxxx&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">datastoreOptions:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">tableName:</span><span class="hl-1"> </span><span class="hl-2">&#39;MyTable&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Create and authenticate a test user</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">createUser</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-2">&#39;custom:attribute&#39;</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-2">&#39;value&#39;</span><span class="hl-1">,</span><br/><span class="hl-1">}, [</span><span class="hl-2">&#39;admin&#39;</span><span class="hl-1">]);</span><br/><br/><span class="hl-6">// Get an authenticated API client</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">client</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">getAuthenticatedClient</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Make API calls</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-7">response</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1">.</span><span class="hl-0">get</span><span class="hl-1">(</span><span class="hl-2">&#39;/items&#39;</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Clean up test data</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">cleanupItems</span><span class="hl-1">();</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">test</span><span class="hl-1">.</span><span class="hl-0">removeUser</span><span class="hl-1">(</span><span class="hl-2">&#39;test@example.com&#39;</span><span class="hl-1">);</span>
46
+ </code><button type="button">Copy</button></pre>
47
+
36
48
  <a id="contribute" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Contribute<a href="#contribute" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="how-to-contribute-to-cdk-serverless" class="tsd-anchor"></a><h3 class="tsd-anchor-link">How to contribute to CDK Serverless<a href="#how-to-contribute-to-cdk-serverless" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><a id="did-you-find-a-bug" class="tsd-anchor"></a><h4 class="tsd-anchor-link"><strong>Did you find a bug?</strong><a href="#did-you-find-a-bug" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h4><ul>
37
49
  <li>
38
50
  <p><strong>Ensure the bug was not already reported</strong> by searching on GitHub under <a href="https://github.com/taimos/cdk-serverless/issues">Issues</a>.</p>
@@ -62,4 +74,4 @@
62
74
  <li>Just file a PR with your recommended changes</li>
63
75
  </ul>
64
76
  <a id="authors" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Authors<a href="#authors" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Brought to you by <a href="https://taimos.de">Taimos</a></p>
65
- </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#cdk-serverless"><span>CDK <wbr/>Serverless</span></a><ul><li><ul><li><a href="#features"><span>Features</span></a></li></ul></li><li><a href="#quick-start"><span>Quick <wbr/>Start</span></a></li><li><ul><li><a href="#adding-projen-constructs"><span>Adding projen constructs</span></a></li><li><a href="#using-the-cdk-serverless-l3-constructs"><span>Using the CDK serverless <wbr/>L3 constructs</span></a></li></ul></li><li><a href="#contribute"><span>Contribute</span></a></li><li><ul><li><a href="#how-to-contribute-to-cdk-serverless"><span>How to contribute to CDK <wbr/>Serverless</span></a></li><li><ul><li><a href="#did-you-find-a-bug"><span>Did you find a bug?</span></a></li><li><a href="#did-you-write-a-patch-that-fixes-a-bug"><span>Did you write a patch that fixes a bug?</span></a></li><li><a href="#did-you-fix-whitespace-format-code-or-make-a-purely-cosmetic-patch"><span>Did you fix whitespace, format code, or make a purely cosmetic patch?</span></a></li><li><a href="#do-you-intend-to-add-a-new-feature-or-change-an-existing-one"><span>Do you intend to add a new feature or change an existing one?</span></a></li><li><a href="#do-you-want-to-contribute-to-the-cdk-serverless-documentation"><span>Do you want to contribute to the CDK <wbr/>Serverless documentation?</span></a></li></ul></li></ul></li><li><a href="#authors"><span>Authors</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">cdk-serverless</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
77
+ </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#cdk-serverless"><span>CDK <wbr/>Serverless</span></a><ul><li><ul><li><a href="#features"><span>Features</span></a></li></ul></li><li><a href="#quick-start"><span>Quick <wbr/>Start</span></a></li><li><ul><li><a href="#adding-projen-constructs"><span>Adding projen constructs</span></a></li><li><a href="#using-the-cdk-serverless-l3-constructs"><span>Using the CDK serverless <wbr/>L3 constructs</span></a></li></ul></li><li><a href="#testing-utilities"><span>Testing <wbr/>Utilities</span></a></li><li><ul><li><a href="#lambdatestutil"><span>Lambda<wbr/>Test<wbr/>Util</span></a></li><li><ul><li><a href="#rest-api-testing"><span>REST API <wbr/>Testing</span></a></li><li><a href="#graphql-testing"><span>GraphQL <wbr/>Testing</span></a></li></ul></li><li><a href="#integtestutil"><span>Integ<wbr/>Test<wbr/>Util</span></a></li></ul></li><li><a href="#contribute"><span>Contribute</span></a></li><li><ul><li><a href="#how-to-contribute-to-cdk-serverless"><span>How to contribute to CDK <wbr/>Serverless</span></a></li><li><ul><li><a href="#did-you-find-a-bug"><span>Did you find a bug?</span></a></li><li><a href="#did-you-write-a-patch-that-fixes-a-bug"><span>Did you write a patch that fixes a bug?</span></a></li><li><a href="#did-you-fix-whitespace-format-code-or-make-a-purely-cosmetic-patch"><span>Did you fix whitespace, format code, or make a purely cosmetic patch?</span></a></li><li><a href="#do-you-intend-to-add-a-new-feature-or-change-an-existing-one"><span>Do you intend to add a new feature or change an existing one?</span></a></li><li><a href="#do-you-want-to-contribute-to-the-cdk-serverless-documentation"><span>Do you want to contribute to the CDK <wbr/>Serverless documentation?</span></a></li></ul></li></ul></li><li><a href="#authors"><span>Authors</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">cdk-serverless</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -1 +1,2 @@
1
1
  export * from './integ-test-util';
2
+ export * from './lambda-test-utils';
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./integ-test-util"), exports);
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdHMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLG9EQUFrQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vaW50ZWctdGVzdC11dGlsJzsiXX0=
18
+ __exportStar(require("./lambda-test-utils"), exports);
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdHMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLG9EQUFrQztBQUNsQyxzREFBb0MiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2ludGVnLXRlc3QtdXRpbCc7XG5leHBvcnQgKiBmcm9tICcuL2xhbWJkYS10ZXN0LXV0aWxzJzsiXX0=
@@ -0,0 +1,44 @@
1
+ import { APIGatewayProxyEventMultiValueQueryStringParameters, APIGatewayProxyEventPathParameters, APIGatewayProxyResult, Context } from 'aws-lambda';
2
+ import { APIGatewayv1Handler } from '../lambda/handler';
3
+ export interface CognitoUser {
4
+ email: string;
5
+ username: string;
6
+ groups: string[];
7
+ }
8
+ export interface LambdaRestTestOptionsBase {
9
+ headers?: Record<string, string>;
10
+ cognito?: CognitoUser;
11
+ }
12
+ export interface LambdaRestTestOptions extends LambdaRestTestOptionsBase {
13
+ path?: string;
14
+ method?: string;
15
+ body?: string;
16
+ pathParameters?: APIGatewayProxyEventPathParameters;
17
+ queryStringParameters?: APIGatewayProxyEventMultiValueQueryStringParameters;
18
+ }
19
+ export declare function createContext(): Context;
20
+ export declare class LambdaRestUnitTest {
21
+ private handler;
22
+ private defaults?;
23
+ constructor(handler: APIGatewayv1Handler, defaults?: LambdaRestTestOptionsBase | undefined);
24
+ private createRestEvent;
25
+ call(options?: LambdaRestTestOptions): Promise<APIGatewayProxyResult>;
26
+ }
27
+ export interface LambdaGraphQLTestOptionsBase {
28
+ cognito?: CognitoUser;
29
+ stash?: Record<string, any>;
30
+ }
31
+ export interface LambdaGraphQLTestOptions extends LambdaGraphQLTestOptionsBase {
32
+ fieldName?: string;
33
+ arguments?: Record<string, any>;
34
+ source?: any;
35
+ parentTypeName?: string;
36
+ prevResult?: Record<string, any>;
37
+ }
38
+ export declare class LambdaGraphQLTest {
39
+ private handler;
40
+ private defaults?;
41
+ constructor(handler: AWSLambda.AppSyncResolverHandler<any, any>, defaults?: LambdaGraphQLTestOptionsBase | undefined);
42
+ private createGraphQLEvent;
43
+ call(options: LambdaGraphQLTestOptions): Promise<any>;
44
+ }
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LambdaGraphQLTest = exports.LambdaRestUnitTest = void 0;
4
+ exports.createContext = createContext;
5
+ function createContext() {
6
+ return {
7
+ callbackWaitsForEmptyEventLoop: false,
8
+ functionName: 'test',
9
+ functionVersion: '1',
10
+ invokedFunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:test',
11
+ memoryLimitInMB: '1024',
12
+ awsRequestId: 'requestId',
13
+ logGroupName: 'logGroupName',
14
+ logStreamName: 'logStreamName',
15
+ getRemainingTimeInMillis: () => 1000,
16
+ done: jest.fn(),
17
+ fail: jest.fn(),
18
+ succeed: jest.fn(),
19
+ identity: undefined,
20
+ clientContext: undefined,
21
+ };
22
+ }
23
+ class LambdaRestUnitTest {
24
+ constructor(handler, defaults) {
25
+ this.handler = handler;
26
+ this.defaults = defaults;
27
+ }
28
+ createRestEvent(options = {}) {
29
+ var _a, _b, _c, _d;
30
+ const { path = '/', method = 'GET', body = '', } = options;
31
+ const headers = {
32
+ ...(_a = this.defaults) === null || _a === void 0 ? void 0 : _a.headers,
33
+ ...options.headers,
34
+ };
35
+ const cognitoClaims = {
36
+ username: 'DummyUser',
37
+ email: 'dummy@example.com',
38
+ groups: [],
39
+ ...(_b = this.defaults) === null || _b === void 0 ? void 0 : _b.cognito,
40
+ ...options.cognito,
41
+ };
42
+ return {
43
+ body,
44
+ headers,
45
+ multiValueHeaders: Object.fromEntries(Object.entries(headers).map(([key, value]) => [key, value ? [value] : []])),
46
+ httpMethod: method,
47
+ isBase64Encoded: false,
48
+ path,
49
+ pathParameters: (_c = options.pathParameters) !== null && _c !== void 0 ? _c : null,
50
+ queryStringParameters: options.queryStringParameters ? Object.fromEntries(Object.entries(options.queryStringParameters).map(([key, value]) => [key, value === null || value === void 0 ? void 0 : value.join(',')])) : null,
51
+ multiValueQueryStringParameters: (_d = options.queryStringParameters) !== null && _d !== void 0 ? _d : null,
52
+ stageVariables: null,
53
+ requestContext: {
54
+ accountId: '123456789012',
55
+ apiId: 'appId',
56
+ authorizer: {
57
+ claims: {
58
+ 'sub': cognitoClaims.username,
59
+ 'cognito:username': cognitoClaims.username,
60
+ 'cognito:groups': (cognitoClaims.groups),
61
+ 'email': cognitoClaims.email,
62
+ },
63
+ },
64
+ protocol: 'HTTP/1.1',
65
+ httpMethod: method,
66
+ identity: {
67
+ accessKey: null,
68
+ accountId: '123456789012',
69
+ apiKey: null,
70
+ apiKeyId: null,
71
+ caller: null,
72
+ clientCert: null,
73
+ cognitoAuthenticationProvider: null,
74
+ cognitoAuthenticationType: null,
75
+ cognitoIdentityId: null,
76
+ cognitoIdentityPoolId: null,
77
+ principalOrgId: null,
78
+ sourceIp: '',
79
+ user: null,
80
+ userAgent: null,
81
+ userArn: null,
82
+ },
83
+ path,
84
+ stage: 'prod',
85
+ requestId: 'requestId',
86
+ requestTimeEpoch: 0,
87
+ resourceId: '',
88
+ resourcePath: '',
89
+ },
90
+ resource: '',
91
+ };
92
+ }
93
+ async call(options = {}) {
94
+ const event = this.createRestEvent(options);
95
+ const context = createContext();
96
+ const result = await this.handler(event, context, () => { });
97
+ if (!result) {
98
+ throw new Error('No result returned from lambda');
99
+ }
100
+ return result;
101
+ }
102
+ }
103
+ exports.LambdaRestUnitTest = LambdaRestUnitTest;
104
+ class LambdaGraphQLTest {
105
+ constructor(handler, defaults) {
106
+ this.handler = handler;
107
+ this.defaults = defaults;
108
+ }
109
+ createGraphQLEvent(options) {
110
+ var _a, _b;
111
+ const { fieldName = 'testField', arguments: args = {}, source = null, parentTypeName = 'Query', prevResult = {}, stash = {}, } = options;
112
+ const cognitoClaims = {
113
+ username: 'DummyUser',
114
+ email: 'dummy@example.com',
115
+ groups: [],
116
+ ...(_a = this.defaults) === null || _a === void 0 ? void 0 : _a.cognito,
117
+ ...options.cognito,
118
+ };
119
+ return {
120
+ arguments: args,
121
+ source,
122
+ info: {
123
+ fieldName,
124
+ parentTypeName,
125
+ selectionSetGraphQL: '',
126
+ selectionSetList: [],
127
+ variables: {},
128
+ },
129
+ request: {
130
+ domainName: null,
131
+ headers: {},
132
+ },
133
+ identity: {
134
+ claims: {
135
+ 'sub': cognitoClaims.username,
136
+ 'cognito:username': cognitoClaims.username,
137
+ 'cognito:groups': cognitoClaims.groups,
138
+ 'email': cognitoClaims.email,
139
+ },
140
+ groups: cognitoClaims.groups,
141
+ sub: cognitoClaims.username,
142
+ accountId: '123456789012',
143
+ cognitoIdentityAuthProvider: null,
144
+ cognitoIdentityAuthType: null,
145
+ cognitoIdentityId: null,
146
+ cognitoIdentityPoolId: null,
147
+ resolverContext: null,
148
+ userArn: null,
149
+ defaultAuthStrategy: 'ALLOW',
150
+ issuer: 'https://cognito-idp.region.amazonaws.com/userPoolId',
151
+ sourceIp: ['127.0.0.1'],
152
+ username: cognitoClaims.username,
153
+ },
154
+ prev: {
155
+ result: prevResult,
156
+ },
157
+ stash: {
158
+ ...(_b = this.defaults) === null || _b === void 0 ? void 0 : _b.stash,
159
+ ...stash,
160
+ },
161
+ };
162
+ }
163
+ async call(options) {
164
+ const event = this.createGraphQLEvent(options);
165
+ const context = createContext();
166
+ const result = await this.handler(event, context, () => { });
167
+ if (!result) {
168
+ throw new Error('No result returned from lambda');
169
+ }
170
+ return result;
171
+ }
172
+ }
173
+ exports.LambdaGraphQLTest = LambdaGraphQLTest;
174
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGFtYmRhLXRlc3QtdXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdHMvbGFtYmRhLXRlc3QtdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBdUJBLHNDQWlCQztBQWpCRCxTQUFnQixhQUFhO0lBQzNCLE9BQU87UUFDTCw4QkFBOEIsRUFBRSxLQUFLO1FBQ3JDLFlBQVksRUFBRSxNQUFNO1FBQ3BCLGVBQWUsRUFBRSxHQUFHO1FBQ3BCLGtCQUFrQixFQUFFLHFEQUFxRDtRQUN6RSxlQUFlLEVBQUUsTUFBTTtRQUN2QixZQUFZLEVBQUUsV0FBVztRQUN6QixZQUFZLEVBQUUsY0FBYztRQUM1QixhQUFhLEVBQUUsZUFBZTtRQUM5Qix3QkFBd0IsRUFBRSxH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1iZGEuQXBwU3luY1Jlc29sdmVyRXZlbnQ8UmVjb3JkPHN0cmluZywgYW55Pj47XG4gIH1cblxuICBhc3luYyBjYWxsKG9wdGlvbnM6IExhbWJkYUdyYXBoUUxUZXN0T3B0aW9ucyk6IFByb21pc2U8YW55PiB7XG4gICAgY29uc3QgZXZlbnQgPSB0aGlzLmNyZWF0ZUdyYXBoUUxFdmVudChvcHRpb25zKTtcbiAgICBjb25zdCBjb250ZXh0ID0gY3JlYXRlQ29udGV4dCgpO1xuICAgIGNvbnN0IHJlc3VsdCA9IGF3YWl0IHRoaXMuaGFuZGxlcihldmVudCwgY29udGV4dCwgKCkgPT4geyB9KTtcbiAgICBpZiAoIXJlc3VsdCkge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdObyByZXN1bHQgcmV0dXJuZWQgZnJvbSBsYW1iZGEnKTtcbiAgICB9XG4gICAgcmV0dXJuIHJlc3VsdDtcbiAgfVxufVxuIl19
package/package.json CHANGED
@@ -38,7 +38,6 @@
38
38
  "@aws-sdk/lib-dynamodb": "3.726.0",
39
39
  "@hapi/boom": "^10.0.1",
40
40
  "@stylistic/eslint-plugin": "^2",
41
- "@types/aws-lambda": "^8.10.148",
42
41
  "@types/jest": "^29.5.14",
43
42
  "@types/js-yaml": "^4.0.9",
44
43
  "@types/jsonwebtoken": "^9.0.9",
@@ -75,6 +74,7 @@
75
74
  "projen": ">=0.91.6 <1.0.0"
76
75
  },
77
76
  "dependencies": {
77
+ "@types/aws-lambda": "^8.10.148",
78
78
  "axios": "^1.8.4",
79
79
  "constructs": "^10.3.0",
80
80
  "date-fns": "^4.1.0",
@@ -96,7 +96,7 @@
96
96
  "publishConfig": {
97
97
  "access": "public"
98
98
  },
99
- "version": "2.18.0",
99
+ "version": "2.19.0",
100
100
  "jest": {
101
101
  "coverageProvider": "v8",
102
102
  "testMatch": [