tideliftcli/manifests_test.go

38 lines
880 B
Go
Raw Normal View History

2019-05-14 03:26:13 +00:00
package main
import (
2019-05-14 21:16:59 +00:00
"sort"
2019-05-14 03:26:13 +00:00
"testing"
"github.com/stretchr/testify/assert"
)
2019-05-14 21:26:22 +00:00
func TestGetListOfGlobMatches(t *testing.T) {
2019-05-14 03:26:13 +00:00
//assert getManifestMatches gets all requirements.txt
expected := []string{
2019-05-15 03:54:04 +00:00
"test/good_config/subdir/requirements.txt",
"test/good_config/a/b/c/d/e/f/g/requirements.txt",
2019-05-14 03:26:13 +00:00
}
2019-05-15 03:54:04 +00:00
got := getListOfGlobMatches("test/good_config", "**/requirements.txt")
2019-05-14 21:16:59 +00:00
sort.Strings(expected)
sort.Strings(got)
2019-05-14 03:26:13 +00:00
assert.Equal(t, expected, got, "they should be equal")
}
2019-05-14 21:26:22 +00:00
func TestGetListOfManifestFilenames(t *testing.T) {
2019-05-14 21:16:59 +00:00
expected := []string{
2019-05-15 03:54:04 +00:00
"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",
2019-05-14 03:26:13 +00:00
}
2019-05-15 03:20:16 +00:00
got := getListOfManifestFilenames("test/good_config")
2019-05-14 03:26:13 +00:00
2019-05-14 21:16:59 +00:00
sort.Strings(expected)
sort.Strings(got)
assert.Equal(t, expected, got, "they should match")
2019-05-14 03:26:13 +00:00
}