@@ -224,15 +224,11 @@ describe("channelsStatusCommand SecretRef fallback flow", () => {
224224
225225 await channelsStatusCommand ( { probe : false } , runtime as never ) ;
226226
227- expect ( errors ) . toEqual (
228- expect . arrayContaining ( [ expect . stringContaining ( "Gateway not reachable" ) ] ) ,
229- ) ;
230- expect ( mocks . resolveCommandConfigWithSecrets ) . toHaveBeenCalledWith (
231- expect . objectContaining ( {
232- commandName : "channels status" ,
233- mode : "read_only_status" ,
234- } ) ,
235- ) ;
227+ expect ( errors . join ( "\n" ) ) . toContain ( "Gateway not reachable" ) ;
228+ expect ( mocks . resolveCommandConfigWithSecrets ) . toHaveBeenCalledOnce ( ) ;
229+ const configResolutionRequest = mocks . resolveCommandConfigWithSecrets . mock . calls [ 0 ] ?. [ 0 ] ;
230+ expect ( configResolutionRequest ?. commandName ) . toBe ( "channels status" ) ;
231+ expect ( configResolutionRequest ?. mode ) . toBe ( "read_only_status" ) ;
236232 expect (
237233 logs . some ( ( line ) =>
238234 line . includes ( "[secrets] channels status: channels.discord.token is unavailable" ) ,
@@ -307,12 +303,13 @@ describe("channelsStatusCommand SecretRef fallback flow", () => {
307303 await channelsStatusCommand ( { json : true , probe : false } , runtime as never ) ;
308304
309305 expect ( mocks . listChannelPlugins ) . not . toHaveBeenCalled ( ) ;
310- expect ( mocks . listConfiguredChannelIdsForReadOnlyScope ) . toHaveBeenCalledWith (
311- expect . objectContaining ( {
312- config : expect . objectContaining ( { secretResolved : true } ) ,
313- includePersistedAuthState : false ,
314- } ) ,
315- ) ;
306+ expect ( mocks . listConfiguredChannelIdsForReadOnlyScope ) . toHaveBeenCalledOnce ( ) ;
307+ const readOnlyScopeRequest = mocks . listConfiguredChannelIdsForReadOnlyScope . mock
308+ . calls [ 0 ] ?. [ 0 ] as
309+ | { config ?: { secretResolved ?: unknown } ; includePersistedAuthState ?: unknown }
310+ | undefined ;
311+ expect ( readOnlyScopeRequest ?. config ?. secretResolved ) . toBe ( true ) ;
312+ expect ( readOnlyScopeRequest ?. includePersistedAuthState ) . toBe ( false ) ;
316313 const payload = JSON . parse ( logs . at ( - 1 ) ?? "{}" ) ;
317314 expect ( errors . join ( "\n" ) ) . not . toContain ( "user:pass" ) ;
318315 expect ( errors . join ( "\n" ) ) . not . toContain ( "secret-token" ) ;
@@ -323,12 +320,8 @@ describe("channelsStatusCommand SecretRef fallback flow", () => {
323320 expect ( payload . error ) . not . toContain ( "secret-token" ) ;
324321 expect ( payload . error ) . not . toContain ( "fallback-user:fallback-pass" ) ;
325322 expect ( payload . error ) . not . toContain ( "fallback-secret" ) ;
326- expect ( payload ) . toEqual (
327- expect . objectContaining ( {
328- gatewayReachable : false ,
329- configOnly : true ,
330- configuredChannels : [ "discord" ] ,
331- } ) ,
332- ) ;
323+ expect ( payload . gatewayReachable ) . toBe ( false ) ;
324+ expect ( payload . configOnly ) . toBe ( true ) ;
325+ expect ( payload . configuredChannels ) . toStrictEqual ( [ "discord" ] ) ;
333326 } ) ;
334327} ) ;
0 commit comments