1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00
goreleaser/internal/extrafiles/extra_files_test.go
Weslei Juan Moser Pereira c805451de0
feat: Added extra files to blob (#1535)
* Reordered indexes in docs

* Fix customization order

* Implemented extra files

* Added tests for extra files

* Added docs

* Fix test with defaults

* Removed path and folder from extra_files

* Fix scope lint

* Removed dead code

* Removed dead code

* Added test for common package

* Fix linting

* Removed false positive from golangci

* Requested changes
2020-05-25 15:07:40 -03:00

69 lines
1.4 KiB
Go

package extrafiles
import (
"testing"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/stretchr/testify/assert"
)
func TestShouldGetAllFiles(t *testing.T) {
assert := assert.New(t)
globs := []config.ExtraFile{
{Glob: "./testdata/file1.golden"},
}
files, err := Find(globs)
assert.NoError(err)
assert.Equal(1, len(files))
path, ok := files["file1.golden"]
assert.True(ok)
assert.Equal(path, "./testdata/file1.golden")
}
func TestShouldGetAllFilesWithGoldenExtension(t *testing.T) {
assert := assert.New(t)
globs := []config.ExtraFile{
{Glob: "./testdata/*.golden"},
}
files, err := Find(globs)
assert.NoError(err)
assert.Equal(2, len(files))
path, ok := files["file1.golden"]
assert.True(ok)
assert.Equal(path, "testdata/file1.golden")
path, ok = files["file2.golden"]
assert.True(ok)
assert.Equal(path, "testdata/file2.golden")
}
func TestShouldGetAllFilesInsideTestdata(t *testing.T) {
assert := assert.New(t)
globs := []config.ExtraFile{
{Glob: "./testdata/*"},
}
files, err := Find(globs)
assert.NoError(err)
assert.Equal(3, len(files))
path, ok := files["file1.golden"]
assert.True(ok)
assert.Equal(path, "testdata/file1.golden")
path, ok = files["file2.golden"]
assert.True(ok)
assert.Equal(path, "testdata/file2.golden")
path, ok = files["file3.gold"]
assert.True(ok)
assert.Equal(path, "testdata/file3.gold")
}