@@ -27,7 +27,82 @@ describe('runserver-simple', () => {
2727
2828 const userId = '100'
2929
30- { // put user
30+ { // put user bad request (id missing)
31+ const response = await http . put ( `/user/${ userId } ` , {
32+ body : JSON . stringify ( {
33+ // id: userId,
34+ name : `User ${ userId } ` ,
35+ birthdate : '2020-01-01' ,
36+ profilePictureUrl : 'https://rubico.land/assets/rubico-logo.png' ,
37+ 38+ } ) ,
39+ } )
40+
41+ assert . equal ( response . status , 400 )
42+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
43+ }
44+
45+ { // put user bad request (name missing)
46+ const response = await http . put ( `/user/${ userId } ` , {
47+ body : JSON . stringify ( {
48+ id : userId ,
49+ // name: `User ${userId}`,
50+ birthdate : '2020-01-01' ,
51+ profilePictureUrl : 'https://rubico.land/assets/rubico-logo.png' ,
52+ 53+ } ) ,
54+ } )
55+
56+ assert . equal ( response . status , 400 )
57+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
58+ }
59+
60+ { // put user bad request (birthdate missing)
61+ const response = await http . put ( `/user/${ userId } ` , {
62+ body : JSON . stringify ( {
63+ id : userId ,
64+ name : `User ${ userId } ` ,
65+ // birthdate: '2020-01-01',
66+ profilePictureUrl : 'https://rubico.land/assets/rubico-logo.png' ,
67+ 68+ } ) ,
69+ } )
70+
71+ assert . equal ( response . status , 400 )
72+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
73+ }
74+
75+ { // put user bad request (profilePictureUrl missing)
76+ const response = await http . put ( `/user/${ userId } ` , {
77+ body : JSON . stringify ( {
78+ id : userId ,
79+ name : `User ${ userId } ` ,
80+ birthdate : '2020-01-01' ,
81+ // profilePictureUrl: 'https://rubico.land/assets/rubico-logo.png',
82+ 83+ } ) ,
84+ } )
85+
86+ assert . equal ( response . status , 400 )
87+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
88+ }
89+
90+ { // put user bad request (email missing)
91+ const response = await http . put ( `/user/${ userId } ` , {
92+ body : JSON . stringify ( {
93+ id : userId ,
94+ name : `User ${ userId } ` ,
95+ birthdate : '2020-01-01' ,
96+ profilePictureUrl : 'https://rubico.land/assets/rubico-logo.png' ,
97+ 98+ } ) ,
99+ } )
100+
101+ assert . equal ( response . status , 400 )
102+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
103+ }
104+
105+ { // put user success
31106 const response = await http . put ( `/user/${ userId } ` , {
32107 body : JSON . stringify ( {
33108 id : userId ,
@@ -87,7 +162,82 @@ describe('runserver-complex', () => {
87162
88163 const userId = '100'
89164
90- { // put user
165+ { // put user bad request (id missing)
166+ const response = await http . put ( `/user/${ userId } ` , {
167+ body : JSON . stringify ( {
168+ // id: userId,
169+ name : `User ${ userId } ` ,
170+ birthdate : '2020-01-01' ,
171+ profilePictureUrl : 'https://rubico.land/assets/rubico-logo.png' ,
172+ 173+ } ) ,
174+ } )
175+
176+ assert . equal ( response . status , 400 )
177+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
178+ }
179+
180+ { // put user bad request (name missing)
181+ const response = await http . put ( `/user/${ userId } ` , {
182+ body : JSON . stringify ( {
183+ id : userId ,
184+ // name: `User ${userId}`,
185+ birthdate : '2020-01-01' ,
186+ profilePictureUrl : 'https://rubico.land/assets/rubico-logo.png' ,
187+ 188+ } ) ,
189+ } )
190+
191+ assert . equal ( response . status , 400 )
192+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
193+ }
194+
195+ { // put user bad request (birthdate missing)
196+ const response = await http . put ( `/user/${ userId } ` , {
197+ body : JSON . stringify ( {
198+ id : userId ,
199+ name : `User ${ userId } ` ,
200+ // birthdate: '2020-01-01',
201+ profilePictureUrl : 'https://rubico.land/assets/rubico-logo.png' ,
202+ 203+ } ) ,
204+ } )
205+
206+ assert . equal ( response . status , 400 )
207+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
208+ }
209+
210+ { // put user bad request (profilePictureUrl missing)
211+ const response = await http . put ( `/user/${ userId } ` , {
212+ body : JSON . stringify ( {
213+ id : userId ,
214+ name : `User ${ userId } ` ,
215+ birthdate : '2020-01-01' ,
216+ // profilePictureUrl: 'https://rubico.land/assets/rubico-logo.png',
217+ 218+ } ) ,
219+ } )
220+
221+ assert . equal ( response . status , 400 )
222+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
223+ }
224+
225+ { // put user bad request (email missing)
226+ const response = await http . put ( `/user/${ userId } ` , {
227+ body : JSON . stringify ( {
228+ id : userId ,
229+ name : `User ${ userId } ` ,
230+ birthdate : '2020-01-01' ,
231+ profilePictureUrl : 'https://rubico.land/assets/rubico-logo.png' ,
232+ 233+ } ) ,
234+ } )
235+
236+ assert . equal ( response . status , 400 )
237+ assert . deepEqual ( await response . text ( ) , 'Bad Request' )
238+ }
239+
240+ { // put user success
91241 const response = await http . put ( `/user/${ userId } ` , {
92242 body : JSON . stringify ( {
93243 id : userId ,
0 commit comments