1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-04-19 12:12:26 +02:00
goreleaser/internal/pipe/artifacts/artifacts_test.go

35 lines
759 B
Go
Raw Normal View History

package artifacts
import (
"path/filepath"
"testing"
"github.com/goreleaser/goreleaser/internal/artifact"
"github.com/goreleaser/goreleaser/internal/golden"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context"
"github.com/stretchr/testify/require"
)
func TestArtifacts(t *testing.T) {
tmp := t.TempDir()
ctx := context.New(config.Project{
Dist: tmp,
})
ctx.Artifacts.Add(&artifact.Artifact{
Name: "foo",
Path: "foo.txt",
Type: artifact.Binary,
Goos: "darwin",
Goarch: "amd64",
Goarm: "7",
Extra: map[string]interface{}{
"foo": "bar",
},
})
require.NoError(t, Pipe{}.Run(ctx))
golden.RequireEqualJSON(t, golden.RequireReadFile(t, filepath.Join(tmp, "artifacts.json")))
}