@@ -170,16 +170,15 @@ describe.sequential("/api/v1/accounts/verify_credentials", () => {
170170 expect ( updateJson . content ) . toBe ( "<p>Test Update</p>\n" ) ;
171171 } ) ;
172172
173- it ( "Issue 177: successfully creates a status with null values for optional fields" , async ( ) => {
174- expect . assertions ( 6 ) ;
173+ it ( "Issue 177: successfully creates a status with null values, setting appropriate defaults" , async ( ) => {
175174 const body = JSON . stringify ( {
176- language : "en" ,
175+ language : null ,
177176 status : "Awoo!" ,
178177 in_reply_to_id : null ,
179178 sensitive : false ,
180179 spoiler_text : null ,
181180 media_ids : null ,
182- visibility : "public" ,
181+ visibility : null ,
183182 poll : null ,
184183 } ) ;
185184
@@ -197,48 +196,18 @@ describe.sequential("/api/v1/accounts/verify_credentials", () => {
197196
198197 const json = await response . json ( ) ;
199198 expect ( typeof json ) . toBe ( "object" ) ;
199+
200+ // Basic creation success
200201 expect ( json . content ) . toBe ( "<p>Awoo!</p>\n" ) ;
201202 expect ( json . account . id ) . toBe ( account . id ) ;
202- expect ( json . language ) . toBe ( "en" ) ;
203- } ) ;
204-
205- it ( "Null values are replaced with appropriate defaults" , async ( ) => {
206- expect . assertions ( 10 ) ;
207-
208- // Send a request with nulls
209- const body = JSON . stringify ( {
210- status : "Testing defaults" ,
211- visibility : null ,
212- in_reply_to_id : null ,
213- spoiler_text : null ,
214- media_ids : null ,
215- poll : null ,
216- language : null ,
217- } ) ;
218-
219- const response = await app . request ( "/api/v1/statuses" , {
220- method : "POST" ,
221- headers : {
222- authorization : bearerAuthorization ( accessToken ) ,
223- "Content-Type" : "application/json" ,
224- } ,
225- body : body ,
226- } ) ;
227-
228- expect ( response . status ) . toBe ( 200 ) ;
229-
230- const json = await response . json ( ) ;
231203
204+ // Verify null values are replaced with appropriate defaults
232205 expect ( json . visibility ) . not . toBeNull ( ) ;
233206 expect ( json . visibility ) . toBe ( "public" ) ;
234- expect ( json . in_reply_to_id ) . toBeNull ( ) ;
235-
236207 expect ( json . spoiler_text ) . toBe ( "" ) ;
237208 expect ( json . media_attachments ) . toEqual ( [ ] ) ;
238- expect ( json . poll ) . toBeNull ( ) ;
239-
240209 expect ( json . sensitive ) . toBe ( false ) ;
241210 expect ( json . language ) . not . toBeNull ( ) ;
242- expect ( json . content ) . toBe ( "<p>Testing defaults</p>\n" ) ;
211+ expect ( json . poll ) . toBeNull ( ) ; // This one stays null as expected
243212 } ) ;
244213} ) ;
0 commit comments