asdf/internal/info/info_test.go
Trevor Brown 620c0d87e8 feat(golang-rewrite): re-organize Go code
* move most Go packages to internal directory
* update import paths
2024-12-18 11:32:02 -05:00

34 lines
837 B
Go

package info
import (
"os"
"path/filepath"
"strings"
"testing"
"asdf/internal/config"
"github.com/stretchr/testify/assert"
)
func TestWrite(t *testing.T) {
testDataDir := t.TempDir()
err := os.MkdirAll(filepath.Join(testDataDir, "plugins"), 0o777)
assert.Nil(t, err)
conf := config.Config{DataDir: testDataDir}
var stdout strings.Builder
err = Write(conf, "0.15.0", &stdout)
assert.Nil(t, err)
output := stdout.String()
// Simple format assertions
assert.True(t, strings.Contains(output, "OS:\n"))
assert.True(t, strings.Contains(output, "BASH VERSION:\n"))
assert.True(t, strings.Contains(output, "SHELL:\n"))
assert.True(t, strings.Contains(output, "ASDF VERSION:\n"))
assert.True(t, strings.Contains(output, "INTERNAL VARIABLES:\n"))
assert.True(t, strings.Contains(output, "ASDF INSTALLED PLUGINS:\n"))
}