@@ -150,4 +150,38 @@ describe('AirtableClient.deleteFields', () => {
150150 assert . equal ( result . succeeded . length , 1 ) ;
151151 assert . equal ( result . failed . length , 1 ) ;
152152 } ) ;
153+
154+ it ( 'routes deleted:false (dependency-blocked) to failed[] when force=false' , async ( ) => {
155+ const DEPENDENCY_RESPONSE = {
156+ ok : false ,
157+ status : 400 ,
158+ json : async ( ) => ( {
159+ error : {
160+ type : 'SCHEMA_DEPENDENCIES_VALIDATION_FAILED' ,
161+ details : { dependentColumns : [ { id : 'fldDEP' , type : 'formula' } ] } ,
162+ } ,
163+ } ) ,
164+ text : async ( ) => JSON . stringify ( { error : { type : 'SCHEMA_DEPENDENCIES_VALIDATION_FAILED' } } ) ,
165+ } ;
166+ const auth = createMockAuth ( {
167+ get ( ) {
168+ return {
169+ ok : true , status : 200 ,
170+ json : async ( ) => ( {
171+ data : { tableSchemas : [ { id : 'tbl1' , columns : [ { id : 'fld001' , name : 'HasDeps' , type : 'formula' , typeOptions : { } } ] , views : [ ] } ] } ,
172+ } ) ,
173+ text : async ( ) => '{}' ,
174+ } ;
175+ } ,
176+ postForm ( ) {
177+ return DEPENDENCY_RESPONSE ;
178+ } ,
179+ } ) ;
180+ const client = new AirtableClient ( auth ) ;
181+ const result = await client . deleteFields ( 'appTEST' , [ { fieldId : 'fld001' , expectedName : 'HasDeps' } ] , { force : false } ) ;
182+ assert . equal ( result . succeeded . length , 0 , 'no fields should be in succeeded' ) ;
183+ assert . equal ( result . failed . length , 1 , 'dependency-blocked field should be in failed' ) ;
184+ assert . ok ( result . failed [ 0 ] . error . includes ( 'dependencies' ) || result . failed [ 0 ] . error . includes ( 'not deleted' ) ,
185+ `error message should mention dependencies or not deleted, got: "${ result . failed [ 0 ] . error } "` ) ;
186+ } ) ;
153187} ) ;
0 commit comments