2017-12-02 19:53:19 -02:00
|
|
|
package snapshot
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2018-08-14 23:50:20 -03:00
|
|
|
"github.com/goreleaser/goreleaser/pkg/config"
|
|
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
2017-12-02 19:53:19 -02:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStringer(t *testing.T) {
|
|
|
|
assert.NotEmpty(t, Pipe{}.String())
|
|
|
|
}
|
|
|
|
func TestDefault(t *testing.T) {
|
2017-12-02 23:07:30 -02:00
|
|
|
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)
|
2017-12-02 19:53:19 -02:00
|
|
|
}
|