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

38 lines
818 B
Go

package main
import (
"sort"
"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")
sort.Strings(expected)
sort.Strings(got)
assert.Equal(t, expected, got, "they should be equal")
}
func TestGetAllManifests(t *testing.T) {
expected := []string{
"test/fixtures/yarn.lock",
"test/fixtures/Gemfile",
"test/fixtures/a/b/c/d/e/f/g/requirements.txt",
"test/fixtures/subdir/requirements.txt",
}
got := getAllManifests("test/")
sort.Strings(expected)
sort.Strings(got)
assert.Equal(t, expected, got, "they should match")
}