Skip to content

Commit 32361a4

Browse files
committed
fix tests for new methods/authorizer model
1 parent 53d6ffe commit 32361a4

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
@@ -13,7 +13,13 @@ void describe('RestApiConstruct Lambda Handling', () => {
1313
apiProps: [
1414
{
1515
path: 'items',
16-
methods: ['GET'],
16+
defaultAuthorizer: { type: 'none' },
17+
methods: [
18+
{
19+
method: 'GET',
20+
authorizer: { type: 'none' },
21+
},
22+
],
1723
lambdaEntry: {
1824
runtime: lambda.Runtime.NODEJS_18_X,
1925
source: { path: 'packages/rest-api-construct/lib/test-assets' },
@@ -35,7 +41,13 @@ void describe('RestApiConstruct Lambda Handling', () => {
3541
apiProps: [
3642
{
3743
path: 'items',
38-
methods: ['GET'],
44+
defaultAuthorizer: { type: 'none' },
45+
methods: [
46+
{
47+
method: 'GET',
48+
authorizer: { type: 'none' },
49+
},
50+
],
3951
lambdaEntry: {
4052
runtime: lambda.Runtime.NODEJS_22_X,
4153
source: {
@@ -61,7 +73,12 @@ void describe('RestApiConstruct', () => {
6173
apiProps: [
6274
{
6375
path: '/test',
64-
methods: ['GET', 'POST'],
76+
methods: [
77+
{
78+
method: 'GET',
79+
authorizer: { type: 'none' },
80+
},
81+
],
6582
lambdaEntry: {
6683
runtime: lambda.Runtime.NODEJS_18_X,
6784
source: {
@@ -71,7 +88,17 @@ void describe('RestApiConstruct', () => {
7188
},
7289
{
7390
path: '/blog',
74-
methods: ['GET', 'POST', 'PUT'],
91+
methods: [
92+
{
93+
method: 'POST',
94+
authorizer: { type: 'userPool', groups: ['Admins'] },
95+
},
96+
{
97+
method: 'GET',
98+
authorizer: { type: 'userPool' },
99+
},
100+
],
101+
defaultAuthorizer: { type: 'userPool' },
75102
lambdaEntry: {
76103
runtime: lambda.Runtime.NODEJS_18_X,
77104
source: {

0 commit comments

Comments
 (0)