github.com/mimetnet/goreleaser@v0.92.0/internal/pipe/snapshot/snapshot_test.go (about) 1 package snapshot 2 3 import ( 4 "testing" 5 6 "github.com/goreleaser/goreleaser/pkg/config" 7 "github.com/goreleaser/goreleaser/pkg/context" 8 "github.com/stretchr/testify/assert" 9 ) 10 11 func TestStringer(t *testing.T) { 12 assert.NotEmpty(t, Pipe{}.String()) 13 } 14 func TestDefault(t *testing.T) { 15 var ctx = &context.Context{ 16 Config: config.Project{ 17 Snapshot: config.Snapshot{}, 18 }, 19 } 20 assert.NoError(t, Pipe{}.Default(ctx)) 21 assert.Equal(t, "SNAPSHOT-{{ .Commit }}", ctx.Config.Snapshot.NameTemplate) 22 } 23 24 func TestDefaultSet(t *testing.T) { 25 var ctx = &context.Context{ 26 Config: config.Project{ 27 Snapshot: config.Snapshot{ 28 NameTemplate: "snap", 29 }, 30 }, 31 } 32 assert.NoError(t, Pipe{}.Default(ctx)) 33 assert.Equal(t, "snap", ctx.Config.Snapshot.NameTemplate) 34 }