@@ -141,16 +141,16 @@ describe('v2 single-file routes', () => {
141141 } )
142142 } )
143143
144- it ( 'conceals download authorization failures' , async ( ) => {
144+ it ( 'returns forbidden for download authorization failures' , async ( ) => {
145145 mocks . download . mockRejectedValue ( new NoWorkspaceAccessError ( ) )
146146
147147 const response = await GET (
148148 new NextRequest ( `http://localhost:3000/api/v2/files/${ FILE_ID } ?workspaceId=${ WORKSPACE_ID } ` ) ,
149149 context
150150 )
151151
152- expect ( response . status ) . toBe ( 404 )
153- expect ( ( await response . json ( ) ) . error . code ) . toBe ( 'NOT_FOUND ' )
152+ expect ( response . status ) . toBe ( 403 )
153+ expect ( ( await response . json ( ) ) . error . code ) . toBe ( 'FORBIDDEN ' )
154154 } )
155155
156156 it ( 'renames through the shared use case and v2 presenter' , async ( ) => {
@@ -170,7 +170,7 @@ describe('v2 single-file routes', () => {
170170 } )
171171 } )
172172
173- it ( 'maps rename conflicts and conceals absent workspace access' , async ( ) => {
173+ it ( 'maps rename conflicts and returns forbidden for absent workspace access' , async ( ) => {
174174 mocks . rename . mockRejectedValueOnce ( new OrchestrationError ( 'conflict' , 'Name exists' ) )
175175 const conflict = await PATCH (
176176 new NextRequest ( `http://localhost:3000/api/v2/files/${ FILE_ID } ` , {
@@ -183,15 +183,15 @@ describe('v2 single-file routes', () => {
183183 expect ( conflict . status ) . toBe ( 409 )
184184
185185 mocks . rename . mockRejectedValueOnce ( new NoWorkspaceAccessError ( ) )
186- const concealed = await PATCH (
186+ const forbidden = await PATCH (
187187 new NextRequest ( `http://localhost:3000/api/v2/files/${ FILE_ID } ` , {
188188 method : 'PATCH' ,
189189 headers : { 'Content-Type' : 'application/json' } ,
190190 body : JSON . stringify ( { workspaceId : WORKSPACE_ID , name : 'renamed.csv' } ) ,
191191 } ) ,
192192 context
193193 )
194- expect ( concealed . status ) . toBe ( 404 )
194+ expect ( forbidden . status ) . toBe ( 403 )
195195 } )
196196
197197 it ( 'returns forbidden when the current workspace role cannot rename the file' , async ( ) => {
0 commit comments