tideliftcli/manifests_test.go
Tyrel Souza 104aa44ef5
chdir
2019-05-15 22:41:12 -04:00

39 lines
787 B
Go

package main
import (
"os"
"sort"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetListOfGlobMatches(t *testing.T) {
//assert getManifestMatches gets all requirements.txt
os.Chdir("test/fixtures")
expected := []string{
"subdir/requirements.txt",
"a/b/c/d/e/f/g/requirements.txt",
}
got := getListOfGlobMatches("**/requirements.txt")
sort.Strings(expected)
sort.Strings(got)
assert.Equal(t, expected, got, "they should be equal")
}
func TestGetListOfManifestFilenames(t *testing.T) {
expected := []string{
"yarn.lock",
"Gemfile",
"a/b/c/d/e/f/g/requirements.txt",
"subdir/requirements.txt",
}
got := getListOfManifestFilenames("test/fixtures")
sort.Strings(expected)
sort.Strings(got)
assert.Equal(t, expected, got, "they should match")
}