-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Miscellaneous tests (colors,
auth0 logout
, build info) (#705)
* Buildinfo tests * Removing dead code and tests to ansi file * Adding auth0 logout * Fixing env check conditional * Fixing linting error --------- Co-authored-by: Will Vedder <[email protected]>
- Loading branch information
Showing
8 changed files
with
59 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ansi | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestShouldUseColors(t *testing.T) { | ||
os.Setenv("CLICOLOR_FORCE", "true") | ||
assert.True(t, shouldUseColors()) | ||
|
||
os.Setenv("CLICOLOR_FORCE", "0") | ||
assert.False(t, shouldUseColors()) | ||
|
||
os.Unsetenv("CLI_COLOR_FORCE") | ||
|
||
os.Setenv("CLICOLOR", "0") | ||
assert.False(t, shouldUseColors()) | ||
os.Unsetenv("CLICOLOR") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package buildinfo | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNewDefaultBuildInfo(t *testing.T) { | ||
assert.Contains(t, NewDefaultBuildInfo().GoVersion, "go1.") | ||
} | ||
|
||
func TestNewBuildInfo(t *testing.T) { | ||
mockBuildInfo := NewBuildInfo("mock-version", "mock-branch", "mock-build-date", "mock-build-user", "mock-go-version", "mock-revision") | ||
|
||
assert.Equal(t, mockBuildInfo, BuildInfo{ | ||
Version: "mock-version", | ||
Branch: "mock-branch", | ||
BuildDate: "mock-build-date", | ||
BuildUser: "mock-build-user", | ||
GoVersion: "mock-go-version", | ||
Revision: "mock-revision", | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters