File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ export const createUser = (userDetails: Partial<User>): User => {
186
186
password,
187
187
email : userDetails . email ! ,
188
188
phoneNumber : userDetails . phoneNumber ! ,
189
- balance : userDetails . balance ! || 0 ,
189
+ balance : Number ( userDetails . balance ! ) || 0 ,
190
190
avatar : userDetails . avatar ! ,
191
191
defaultPrivacyLevel : userDetails . defaultPrivacyLevel ! ,
192
192
createdAt : new Date ( ) ,
Original file line number Diff line number Diff line change @@ -135,6 +135,25 @@ describe("Users API", function () {
135
135
} ) ;
136
136
} ) ;
137
137
138
+ it ( "creates a new user with an account balance in cents" , function ( ) {
139
+ const firstName = faker . name . firstName ( ) ;
140
+
141
+ cy . request ( "POST" , `${ apiUsers } ` , {
142
+ firstName,
143
+ lastName : faker . name . lastName ( ) ,
144
+ username : faker . internet . userName ( ) ,
145
+ password : faker . internet . password ( ) ,
146
+ email : faker . internet . email ( ) ,
147
+ phoneNumber : faker . phone . phoneNumber ( ) ,
148
+ avatar : faker . internet . avatar ( ) ,
149
+ balance : 100_00 ,
150
+ } ) . then ( ( response ) => {
151
+ expect ( response . status ) . to . eq ( 201 ) ;
152
+ expect ( response . body . user ) . to . contain ( { firstName } ) ;
153
+ expect ( response . body . user . balance ) . to . equal ( 100_00 ) ;
154
+ } ) ;
155
+ } ) ;
156
+
138
157
it ( "error when invalid field sent" , function ( ) {
139
158
cy . request ( {
140
159
method : "POST" ,
You can’t perform that action at this time.
0 commit comments