diff --git a/src/segments/bazel_test.go b/src/segments/bazel_test.go index 0fe54af1b7eb..5e91dc58511c 100644 --- a/src/segments/bazel_test.go +++ b/src/segments/bazel_test.go @@ -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{ @@ -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)