@@ -354,7 +354,23 @@ describe("resolveDiscordThreadStarter", () => {
354354 expect ( get ) . toHaveBeenCalledOnce ( ) ;
355355 } ) ;
356356
357- it ( "does not cache an unresolved parent type before forum metadata recovers" , async ( ) => {
357+ it ( "resolves thread starters when their parent type is unavailable" , async ( ) => {
358+ const threadId = `unknown-parent-type-starter-${ ++ threadIdIndex } ` ;
359+ const get = vi . fn ( ) . mockResolvedValue ( createStarterMessage ( { content : "visible starter" } ) ) ;
360+
361+ await expect (
362+ resolveDiscordThreadStarter ( {
363+ channel : { id : threadId } ,
364+ client : { rest : { get } } as unknown as Client ,
365+ accountId : "test-account" ,
366+ parentId : "parent-1" ,
367+ resolveTimestampMs : ( ) => undefined ,
368+ } ) ,
369+ ) . resolves . toMatchObject ( { text : "visible starter" } ) ;
370+ expect ( get ) . toHaveBeenCalledExactlyOnceWith ( `/channels/parent-1/messages/${ threadId } ` ) ;
371+ } ) ;
372+
373+ it ( "keeps parent-route misses separate when forum metadata recovers" , async ( ) => {
358374 const threadId = `recovering-forum-starter-${ ++ threadIdIndex } ` ;
359375 const get = vi . fn ( async ( path : string ) =>
360376 path === `/channels/${ threadId } /messages/${ threadId } `
@@ -373,13 +389,13 @@ describe("resolveDiscordThreadStarter", () => {
373389 await expect (
374390 resolveDiscordThreadStarter ( { ...params , parentType : undefined } ) ,
375391 ) . resolves . toBeNull ( ) ;
376- expect ( get ) . not . toHaveBeenCalled ( ) ;
392+ expect ( get ) . toHaveBeenCalledExactlyOnceWith ( `/channels/parent-1/messages/ ${ threadId } ` ) ;
377393
378394 await expect (
379395 resolveDiscordThreadStarter ( { ...params , parentType : ChannelType . GuildForum } ) ,
380396 ) . resolves . toMatchObject ( { text : "recovered forum starter" } ) ;
381- expect ( get ) . toHaveBeenCalledOnce ( ) ;
382- expect ( firstRestGetPath ( get ) ) . toBe ( `/channels/${ threadId } /messages/${ threadId } ` ) ;
397+ expect ( get ) . toHaveBeenCalledTimes ( 2 ) ;
398+ expect ( get ) . toHaveBeenNthCalledWith ( 2 , `/channels/${ threadId } /messages/${ threadId } ` ) ;
383399 } ) ;
384400
385401 it ( "falls back to joined embed title and description when content is empty" , async ( ) => {
0 commit comments