Skip to content

Commit

Permalink
fix(segment): correct failing tests
Browse files Browse the repository at this point in the history
Update the tests so that they consider the new default template with the link embedded in the icon
  • Loading branch information
TendTo committed Nov 9, 2023
1 parent 3cb27da commit 39101b5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/segments/bazel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ import (
"github.com/stretchr/testify/assert"
)

const icon = "\ue63a"

func TestBazel(t *testing.T) {
cases := []struct {
Case string
ExpectedString string
Version string
Template string
}{
{Case: "bazel 6.4.0", ExpectedString: "6.4.0", Version: "bazel 6.4.0"},
{Case: "bazel 10.11.12", ExpectedString: "10.11.12", Version: "bazel 10.11.12"},
{Case: "bazel error", ExpectedString: "err parsing info from bazel with", Version: ""},
{Case: "", ExpectedString: "err parsing info from bazel with", Version: ""},
{Case: "bazel 6.4.0", ExpectedString: fmt.Sprintf("«%s»(https://bazel.build/versions/6.4.0) 6.4.0", icon), Version: "bazel 6.4.0", Template: ""},
{Case: "bazel 10.11.12", ExpectedString: fmt.Sprintf("«%s»(https://docs.bazel.build/versions/3.7.0) 3.7.0", icon), Version: "bazel 3.7.0"},
{Case: "", ExpectedString: fmt.Sprintf("%s err parsing info from bazel with", icon), Version: ""},
}
for _, tc := range cases {
params := &mockedLanguageParams{
Expand All @@ -26,6 +28,7 @@ func TestBazel(t *testing.T) {
extension: "*.bazel",
}
env, props := getMockedLanguageEnv(params)
props[Icon] = icon
b := &Bazel{}
b.Init(props, env)
failMsg := fmt.Sprintf("Failed in case: %s", tc.Case)
Expand Down

0 comments on commit 39101b5

Please sign in to comment.