Skip to content

Commit be7a583

Browse files
committed
feat: test-codecov-report
1 parent 1a12fd5 commit be7a583

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

pkg/cmd/hello/hello_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
11
package 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+
}

pkg/cmd/hello/onboarding_utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
126130
func SetupDefaultOnboardingFile() error {
127131
// get path
128132
path, err := GetOnboardingFilePath()

pkg/cmd/hello/steps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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()

0 commit comments

Comments
 (0)