@@ -96,8 +96,45 @@ describe('Update-Buy-Ins tests', () => {
9696 expect ( result . statusCode ) . toBe ( 403 ) ;
9797 expect ( JSON . parse ( result . body ) . message ) . toBe ( 'Points distributed exceed user point total.' ) ;
9898 } ) ;
99+ //case 5
100+ it ( 'non-numeric value entered for input' , async ( ) => {
101+ findOneMock . mockReturnValueOnce ( {
102+ email : userData . email ,
103+ total_points : 30 ,
104+ balance : 2 ,
105+ buy_ins : [
106+ { prize_id : 'prize1' , buy_in : 'random' } ,
107+ { prize_id : 'prize2' , buy_in : 20 } ,
108+ ] ,
109+ } ) ;
99110
100- // case 5
111+ const mockEvent = createEvent ( userData , path , httpMethod ) ;
112+
113+ const result = await main ( mockEvent , mockContext , mockCallback ) ;
114+
115+ expect ( result . statusCode ) . toBe ( 403 ) ;
116+ expect ( JSON . parse ( result . body ) . message ) . toBe ( 'Requested point change is not a valid integer input' ) ;
117+ } ) ;
118+ // case 6
119+ it ( 'Buy-in points out of range' , async ( ) => {
120+ findOneMock . mockReturnValueOnce ( {
121+ email : userData . email ,
122+ total_points : 30 ,
123+ balance : 2 ,
124+ buy_ins : [
125+ { prize_id : 'prize1' , buy_in : 1500 } ,
126+ { prize_id : 'prize2' , buy_in : 20 } ,
127+ ] ,
128+ } ) ;
129+
130+ const mockEvent = createEvent ( userData , path , httpMethod ) ;
131+
132+ const result = await main ( mockEvent , mockContext , mockCallback ) ;
133+
134+ expect ( result . statusCode ) . toBe ( 403 ) ;
135+ expect ( JSON . parse ( result . body ) . message ) . toBe ( 'Requested point change is not in a valid point range' ) ;
136+ } ) ;
137+ // case 7
101138 it ( 'successfully update user point balance' , async ( ) => {
102139 findOneMock . mockReturnValueOnce ( {
103140 email : userData . email ,
0 commit comments