@@ -190,6 +190,48 @@ describe("dropItem", () => {
190190 expect ( mockServerWriteFile ) . not . toHaveBeenCalled ( ) ;
191191 } ) ;
192192
193+ it ( "accepts a default status on a legacy board without explicit statuses" , async ( ) => {
194+ const { statuses : _statuses , ...legacyBoard } = mockBoard ;
195+ mockGetListById . mockImplementation ( async ( id : string ) =>
196+ id === BOARD_UUID ? structuredClone ( legacyBoard ) : undefined ,
197+ ) ;
198+
199+ const result = await dropItem (
200+ createFormData ( {
201+ uuid : BOARD_UUID ,
202+ itemId : "task-1" ,
203+ targetStatus : "in_progress" ,
204+ targetIndex : "0" ,
205+ } ) ,
206+ ) ;
207+
208+ expect ( result . success ) . toBe ( true ) ;
209+ expect ( result . data ! . items . find ( ( i ) => i . id === "task-1" ) ?. status ) . toBe (
210+ "in_progress" ,
211+ ) ;
212+ expect ( mockServerWriteFile ) . toHaveBeenCalledTimes ( 1 ) ;
213+ } ) ;
214+
215+ it ( "rejects a target status that is not a default when none are defined" , async ( ) => {
216+ const { statuses : _statuses , ...legacyBoard } = mockBoard ;
217+ mockGetListById . mockImplementation ( async ( id : string ) =>
218+ id === BOARD_UUID ? structuredClone ( legacyBoard ) : undefined ,
219+ ) ;
220+
221+ const result = await dropItem (
222+ createFormData ( {
223+ uuid : BOARD_UUID ,
224+ itemId : "task-1" ,
225+ targetStatus : "nonsense" ,
226+ targetIndex : "0" ,
227+ } ) ,
228+ ) ;
229+
230+ expect ( result . success ) . toBe ( false ) ;
231+ expect ( result . error ) . toBe ( "Invalid target status" ) ;
232+ expect ( mockServerWriteFile ) . not . toHaveBeenCalled ( ) ;
233+ } ) ;
234+
193235 it ( "rejects without edit permission" , async ( ) => {
194236 mockCheckUserPermission . mockResolvedValue ( false ) ;
195237
0 commit comments