@@ -83,11 +83,12 @@ async function registerAndGetToken(username: string, email: string, password = '
8383}
8484
8585async function makeVisible ( token : string , itineraryId : string ) : Promise < void > {
86- await app . request ( `/api/v1/users/me/bookmarks/${ itineraryId } /visibility` , {
86+ const res = await app . request ( `/api/v1/users/me/bookmarks/${ itineraryId } /visibility` , {
8787 method : 'PATCH' ,
8888 headers : { 'Content-Type' : 'application/json' , Authorization : `Bearer ${ token } ` } ,
8989 body : JSON . stringify ( { is_visible : true } ) ,
9090 } , env ) ;
91+ expect ( res . status ) . toBe ( 200 ) ;
9192}
9293
9394describe ( 'PATCH /api/v1/users/me/profile' , ( ) => {
@@ -313,6 +314,20 @@ describe('GET /api/v1/users (public feed)', () => {
313314 expect ( json . data . hasMore ) . toBe ( false ) ;
314315 } ) ;
315316
317+ it ( 'new itinerary is private by default (not visible in public feed)' , async ( ) => {
318+ const token = await registerAndGetToken ( 'defaultprivateuser' , 'defaultprivate@example.com' ) ;
319+
320+ await app . request ( '/api/v1/itineraries' , {
321+ method : 'POST' ,
322+ headers : { 'Content-Type' : 'application/json' , Authorization : `Bearer ${ token } ` } ,
323+ body : JSON . stringify ( { title : 'デフォルト非公開しおり' } ) ,
324+ } , env ) ;
325+
326+ const res = await app . request ( '/api/v1/users' , { } , env ) ;
327+ const json = await res . json ( ) as { data : { items : unknown [ ] } } ;
328+ expect ( json . data . items ) . toHaveLength ( 0 ) ;
329+ } ) ;
330+
316331 it ( 'returns public bookmarks with username' , async ( ) => {
317332 const token = await registerAndGetToken ( 'feeduser' , 'feed@example.com' ) ;
318333
0 commit comments