tideliftcli/manifests_test.go
2019-05-15 22:41:12 -04:00

38 lines
880 B
Go

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