mirror of
https://github.com/ivuorinen/gibidify.git
synced 2026-02-16 12:50:30 +00:00
feat: update go to 1.25, add permissions and envs (#49)
* chore(ci): update go to 1.25, add permissions and envs * fix(ci): update pr-lint.yml * chore: update go, fix linting * fix: tests and linting * fix(lint): lint fixes, renovate should now pass * fix: updates, security upgrades * chore: workflow updates, lint * fix: more lint, checkmake, and other fixes * fix: more lint, convert scripts to POSIX compliant * fix: simplify codeql workflow * tests: increase test coverage, fix found issues * fix(lint): editorconfig checking, add to linters * fix(lint): shellcheck, add to linters * fix(lint): apply cr comment suggestions * fix(ci): remove step-security/harden-runner * fix(lint): remove duplication, apply cr fixes * fix(ci): tests in CI/CD pipeline * chore(lint): deduplication of strings * fix(lint): apply cr comment suggestions * fix(ci): actionlint * fix(lint): apply cr comment suggestions * chore: lint, add deps management
This commit is contained in:
62
cli/ui_terminal_test.go
Normal file
62
cli/ui_terminal_test.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIsColorTerminal(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
env terminalEnvSetup
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "dumb terminal",
|
||||
env: envDumbTerminal,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "empty TERM",
|
||||
env: envEmptyTerm,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "CI without GitHub Actions",
|
||||
env: envCIWithoutGitHub,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "GitHub Actions",
|
||||
env: envGitHubActions,
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "NO_COLOR set",
|
||||
env: envNoColor,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "FORCE_COLOR set",
|
||||
env: envForceColor,
|
||||
expected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
tt.env.apply(t)
|
||||
|
||||
result := isColorTerminal()
|
||||
assert.Equal(t, tt.expected, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsInteractiveTerminal(t *testing.T) {
|
||||
// This function checks if stderr is a terminal
|
||||
// In test environment, it will typically return false
|
||||
result := isInteractiveTerminal()
|
||||
assert.False(t, result)
|
||||
}
|
||||
Reference in New Issue
Block a user