Skip to content

Commit 6ada159

Browse files
committed
fix tests for new methods/authorizer model
1 parent aa83e3d commit 6ada159

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

packages/rest-api-construct/src/construct.test.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ void describe('RestApiConstruct Lambda Handling', () => {
1515
apiProps: [
1616
{
1717
path: 'items',
18-
methods: ['GET'],
18+
defaultAuthorizer: { type: 'none' },
19+
methods: [
20+
{
21+
method: 'GET',
22+
authorizer: { type: 'none' },
23+
},
24+
],
1925
lambdaEntry: {
2026
runtime: lambda.Runtime.NODEJS_18_X,
2127
source: { path: 'packages/rest-api-construct/lib/test-assets' },
@@ -37,7 +43,13 @@ void describe('RestApiConstruct Lambda Handling', () => {
3743
apiProps: [
3844
{
3945
path: 'items',
40-
methods: ['GET'],
46+
defaultAuthorizer: { type: 'none' },
47+
methods: [
48+
{
49+
method: 'GET',
50+
authorizer: { type: 'none' },
51+
},
52+
],
4153
lambdaEntry: {
4254
runtime: lambda.Runtime.NODEJS_22_X,
4355
source: {
@@ -151,7 +163,12 @@ void describe('RestApiConstruct', () => {
151163
apiProps: [
152164
{
153165
path: '/test',
154-
methods: ['GET', 'POST'],
166+
methods: [
167+
{
168+
method: 'GET',
169+
authorizer: { type: 'none' },
170+
},
171+
],
155172
lambdaEntry: {
156173
runtime: lambda.Runtime.NODEJS_18_X,
157174
source: {
@@ -161,7 +178,17 @@ void describe('RestApiConstruct', () => {
161178
},
162179
{
163180
path: '/blog',
164-
methods: ['GET', 'POST', 'PUT'],
181+
methods: [
182+
{
183+
method: 'POST',
184+
authorizer: { type: 'userPool', groups: ['Admins'] },
185+
},
186+
{
187+
method: 'GET',
188+
authorizer: { type: 'userPool' },
189+
},
190+
],
191+
defaultAuthorizer: { type: 'userPool' },
165192
lambdaEntry: {
166193
runtime: lambda.Runtime.NODEJS_18_X,
167194
source: {

0 commit comments

Comments
 (0)