@@ -19,9 +19,9 @@ const updateTemplateMock = jest.spyOn(
1919describe ( 'Template API - Update' , ( ) => {
2020 beforeEach ( jest . resetAllMocks ) ;
2121
22- test ( 'should return 400 - Invalid request when, no email in requestContext' , async ( ) => {
22+ test ( 'should return 400 - Invalid request when, no user in requestContext' , async ( ) => {
2323 const event = mock < APIGatewayProxyEvent > ( {
24- requestContext : { authorizer : { email : undefined } } ,
24+ requestContext : { authorizer : { user : undefined } } ,
2525 body : JSON . stringify ( { name : 'test' } ) ,
2626 pathParameters : { templateId : '1-2-3' } ,
2727 } ) ;
@@ -52,7 +52,7 @@ describe('Template API - Update', () => {
5252 } ) ;
5353
5454 const event = mock < APIGatewayProxyEvent > ( {
55- requestContext : { authorizer : { email : 'email ' } } ,
55+ requestContext : { authorizer : { user : 'sub ' } } ,
5656 pathParameters : { templateId : '1-2-3' } ,
5757 body : undefined ,
5858 } ) ;
@@ -70,14 +70,14 @@ describe('Template API - Update', () => {
7070 } ) ,
7171 } ) ;
7272
73- expect ( TemplateClient ) . toHaveBeenCalledWith ( 'email ' ) ;
73+ expect ( TemplateClient ) . toHaveBeenCalledWith ( 'sub ' ) ;
7474
7575 expect ( updateTemplateMock ) . toHaveBeenCalledWith ( '1-2-3' , { } ) ;
7676 } ) ;
7777
7878 test ( 'should return 400 - Invalid request when, no templateId' , async ( ) => {
7979 const event = mock < APIGatewayProxyEvent > ( {
80- requestContext : { authorizer : { email : 'email ' } } ,
80+ requestContext : { authorizer : { user : 'sub ' } } ,
8181 body : JSON . stringify ( { name : 'test' } ) ,
8282 pathParameters : { templateId : undefined } ,
8383 } ) ;
@@ -104,7 +104,7 @@ describe('Template API - Update', () => {
104104 } ) ;
105105
106106 const event = mock < APIGatewayProxyEvent > ( {
107- requestContext : { authorizer : { email : 'email ' } } ,
107+ requestContext : { authorizer : { user : 'sub ' } } ,
108108 body : JSON . stringify ( { name : 'name' } ) ,
109109 pathParameters : { templateId : '1-2-3' } ,
110110 } ) ;
@@ -119,7 +119,7 @@ describe('Template API - Update', () => {
119119 } ) ,
120120 } ) ;
121121
122- expect ( TemplateClient ) . toHaveBeenCalledWith ( 'email ' ) ;
122+ expect ( TemplateClient ) . toHaveBeenCalledWith ( 'sub ' ) ;
123123
124124 expect ( updateTemplateMock ) . toHaveBeenCalledWith ( '1-2-3' , { name : 'name' } ) ;
125125 } ) ;
@@ -144,7 +144,7 @@ describe('Template API - Update', () => {
144144 } ) ;
145145
146146 const event = mock < APIGatewayProxyEvent > ( {
147- requestContext : { authorizer : { email : 'email ' } } ,
147+ requestContext : { authorizer : { user : 'sub ' } } ,
148148 body : JSON . stringify ( update ) ,
149149 pathParameters : { templateId : '1-2-3' } ,
150150 } ) ;
@@ -156,7 +156,7 @@ describe('Template API - Update', () => {
156156 body : JSON . stringify ( { statusCode : 200 , template : response } ) ,
157157 } ) ;
158158
159- expect ( TemplateClient ) . toHaveBeenCalledWith ( 'email ' ) ;
159+ expect ( TemplateClient ) . toHaveBeenCalledWith ( 'sub ' ) ;
160160
161161 expect ( updateTemplateMock ) . toHaveBeenCalledWith ( '1-2-3' , update ) ;
162162 } ) ;
0 commit comments