mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
test: added test for snapshot
Added tests for snapshot defaulter
This commit is contained in:
parent
0d9da86624
commit
f9cdb2df04
@ -3,13 +3,32 @@ 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) {
|
||||
// TODO: implement this
|
||||
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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user