@@ -4,9 +4,11 @@ import (
44 "encoding/json"
55 "os"
66 "path/filepath"
7+ "strings"
78 "testing"
89
910 "github.com/basecamp/cli/credstore"
11+ "github.com/basecamp/cli/output"
1012 "github.com/basecamp/cli/profile"
1113 "github.com/basecamp/fizzy-cli/internal/config"
1214 "gopkg.in/yaml.v3"
@@ -507,6 +509,41 @@ func TestAuthList(t *testing.T) {
507509 t .Errorf ("expected 0 profiles, got %d" , len (profiles ))
508510 }
509511 })
512+
513+ t .Run ("renders styled output with next steps" , func (t * testing.T ) {
514+ credDir := t .TempDir ()
515+ profileDir := t .TempDir ()
516+
517+ os .Setenv ("FIZZY_LIST_STYLED_NO_KR" , "1" )
518+ defer os .Unsetenv ("FIZZY_LIST_STYLED_NO_KR" )
519+ store := credstore .NewStore (credstore.StoreOptions {
520+ ServiceName : "fizzy-list-styled-test" ,
521+ DisableEnvVar : "FIZZY_LIST_STYLED_NO_KR" ,
522+ FallbackDir : credDir ,
523+ })
524+ profileStore := profile .NewStore (filepath .Join (profileDir , "config.json" ))
525+ profileStore .Create (& profile.Profile {Name : "acme" , BaseURL : "https://app.fizzy.do" })
526+ t1 , _ := json .Marshal ("token1" )
527+ store .Save ("profile:acme" , t1 )
528+
529+ mock := NewMockClient ()
530+ SetTestModeWithSDK (mock )
531+ SetTestCreds (store )
532+ SetTestProfiles (profileStore )
533+ SetTestFormat (output .FormatStyled )
534+ defer resetTest ()
535+
536+ err := authListCmd .RunE (authListCmd , []string {})
537+ assertExitCode (t , err , 0 )
538+
539+ raw := TestOutput ()
540+ if ! strings .Contains (raw , "Profile" ) {
541+ t .Fatalf ("expected styled table output, got:\n %s" , raw )
542+ }
543+ if ! strings .Contains (raw , "Next steps:" ) {
544+ t .Fatalf ("expected next steps section, got:\n %s" , raw )
545+ }
546+ })
510547}
511548
512549func TestAuthSwitch (t * testing.T ) {
0 commit comments