File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package hello
2+
3+ import "testing"
4+
5+ func TestShellOnboardingPollDone (t * testing.T ) {
6+ t .Parallel ()
7+ if ! shellOnboardingPollDone (& OnboardingObject {HasRunBrevShell : true }) {
8+ t .Fatal ("expected true when HasRunBrevShell is set" )
9+ }
10+ if shellOnboardingPollDone (& OnboardingObject {HasRunBrevShell : false }) {
11+ t .Fatal ("expected false when HasRunBrevShell is false" )
12+ }
13+ if shellOnboardingPollDone (& OnboardingObject {HasRunBrevOpen : true , HasRunBrevShell : false }) {
14+ t .Fatal ("HasRunBrevOpen alone must not end shell onboarding wait" )
15+ }
16+ if shellOnboardingPollDone (nil ) {
17+ t .Fatal ("expected false for nil res" )
18+ }
19+ }
Original file line number Diff line number Diff line change @@ -123,6 +123,10 @@ type OnboardingObject struct {
123123 HasRunBrevOpen bool `json:"hasRunBrevOpen"`
124124}
125125
126+ func shellOnboardingPollDone (res * OnboardingObject ) bool {
127+ return res != nil && res .HasRunBrevShell
128+ }
129+
126130func SetupDefaultOnboardingFile () error {
127131 // get path
128132 path , err := GetOnboardingFilePath ()
Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ func doBrevShellOnboarding(
242242 if err1 != nil {
243243 return breverrors .WrapAndTrace (err1 )
244244 }
245- if res . HasRunBrevOpen {
245+ if shellOnboardingPollDone ( res ) {
246246 spinner .Suffix = spinnerSuffix
247247 time .Sleep (250 * time .Millisecond )
248248 spinner .Stop ()
You can’t perform that action at this time.
0 commit comments