github.com/ahmet2mir/goreleaser@v0.180.3-0.20210927151101-8e5ee5a9b8c5/internal/pipe/announce/announce_test.go (about) 1 package announce 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/require" 9 ) 10 11 func TestDescription(t *testing.T) { 12 require.NotEmpty(t, Pipe{}.String()) 13 } 14 15 func TestAnnounce(t *testing.T) { 16 ctx := context.New(config.Project{ 17 Announce: config.Announce{ 18 Twitter: config.Twitter{ 19 Enabled: true, 20 }, 21 }, 22 }) 23 require.Error(t, Pipe{}.Run(ctx)) 24 } 25 26 func TestAnnounceAllDisabled(t *testing.T) { 27 ctx := context.New(config.Project{}) 28 require.NoError(t, Pipe{}.Run(ctx)) 29 } 30 31 func TestSkip(t *testing.T) { 32 t.Run("skip", func(t *testing.T) { 33 ctx := context.New(config.Project{}) 34 ctx.SkipAnnounce = true 35 require.True(t, Pipe{}.Skip(ctx)) 36 }) 37 38 t.Run("dont skip", func(t *testing.T) { 39 require.False(t, Pipe{}.Skip(context.New(config.Project{}))) 40 }) 41 }