1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/internal/pipe/snapshot/snapshot_test.go
2018-09-12 14:18:01 -03:00

35 lines
758 B
Go

package snapshot
import (
"testing"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context"
"github.com/stretchr/testify/assert"
)
func TestStringer(t *testing.T) {
assert.NotEmpty(t, Pipe{}.String())
}
func TestDefault(t *testing.T) {
var ctx = &context.Context{
Config: config.Project{
Snapshot: config.Snapshot{},
},
}
assert.NoError(t, Pipe{}.Default(ctx))
assert.Equal(t, "SNAPSHOT-{{ .Commit }}", ctx.Config.Snapshot.NameTemplate)
}
func TestDefaultSet(t *testing.T) {
var ctx = &context.Context{
Config: config.Project{
Snapshot: config.Snapshot{
NameTemplate: "snap",
},
},
}
assert.NoError(t, Pipe{}.Default(ctx))
assert.Equal(t, "snap", ctx.Config.Snapshot.NameTemplate)
}