mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-26 13:24:59 -07:00
f657055832
* Implement info command * Remove duplicate and unneeded BATS tests from `main_test.go` * remove download dir for plugin when removing plugin * update plugins.Add function so downloads directory is created
34 lines
828 B
Go
34 lines
828 B
Go
package info
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"asdf/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"))
|
|
}
|