1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/pipeline/snapshot/snapshot_test.go
Carlos Alexandro Becker f9cdb2df04 test: added test for snapshot
Added tests for snapshot defaulter
2017-12-03 13:00:01 -02:00

35 lines
750 B
Go

package snapshot
import (
"testing"
"github.com/goreleaser/goreleaser/config"
"github.com/goreleaser/goreleaser/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)
}