@@ -242,7 +242,7 @@ func newOpts(
242242 t .Helper ()
243243 seedToken (t )
244244
245- f , out := test .NewFactory (isTTY , nil , nil , "" )
245+ f , out := test .NewFactory (isTTY , nil , test . NewDefaultConfigStub () , "" )
246246 opened := new (string )
247247 opts := & CreateOptions {
248248 IO : f .IOStreams ,
@@ -278,6 +278,21 @@ func TestRun_FreeNonInteractive(t *testing.T) {
278278 assert .Contains (t , out .String (), "APP1" )
279279}
280280
281+ func TestRun_StructuredOutputPersistsProfile (t * testing.T ) {
282+ srv := newServer (t , `{"has_payment_method": false}` )
283+ defer srv .Close ()
284+
285+ opts , out , _ := newOpts (t , srv , false )
286+ cfg := opts .Config .(* test.ConfigStub )
287+ opts .AcceptTerms = true
288+ opts .Default = true
289+
290+ require .NoError (t , runCreateCmd (context .Background (), opts ))
291+ assert .Equal (t , "APP1" , cfg .CurrentAppID )
292+ assert .Equal (t , "test-api-key" , cfg .SavedApps ["APP1" ].APIKey )
293+ assert .Contains (t , out .String (), "APP1" )
294+ }
295+
281296func TestRun_NonInteractiveRequiresAcceptTerms (t * testing.T ) {
282297 srv := newServer (t , `{"has_payment_method": true}` )
283298 defer srv .Close ()
0 commit comments