tideliftcli/main_test.go

38 lines
818 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"
)
func TestGetManifestGlobMatches(t *testing.T) {
//assert getManifestMatches gets all requirements.txt
expected := []string{
"test/fixtures/subdir/requirements.txt",
"test/fixtures/a/b/c/d/e/f/g/requirements.txt",
}
got := getManifestGlobMatches("test/**/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")
}
func TestGetAllManifests(t *testing.T) {
2019-05-14 21:16:59 +00:00
expected := []string{
2019-05-14 03:26:13 +00:00
"test/fixtures/yarn.lock",
"test/fixtures/Gemfile",
"test/fixtures/a/b/c/d/e/f/g/requirements.txt",
2019-05-14 21:16:59 +00:00
"test/fixtures/subdir/requirements.txt",
2019-05-14 03:26:13 +00:00
}
got := getAllManifests("test/")
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
}