Codebase list golang-github-nlopes-slack / 33fb859d-7349-4038-abd4-9c43e3922006/upstream/0.6.0 block_image_test.go
33fb859d-7349-4038-abd4-9c43e3922006/upstream/0.6.0

Tree @33fb859d-7349-4038-abd4-9c43e3922006/upstream/0.6.0 (Download .tar.gz)

block_image_test.go @33fb859d-7349-4038-abd4-9c43e3922006/upstream/0.6.0raw · history · blame

package slack

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestNewImageBlock(t *testing.T) {

	imageText := NewTextBlockObject("plain_text", "Location", false, false)
	imageBlock := NewImageBlock("https://api.slack.com/img/blocks/bkb_template_images/tripAgentLocationMarker.png", "Marker", "test", imageText)

	assert.Equal(t, string(imageBlock.Type), "image")
	assert.Equal(t, imageBlock.Title.Type, "plain_text")
	assert.Equal(t, imageBlock.BlockID, "test")
	assert.Contains(t, imageBlock.Title.Text, "Location")
	assert.Contains(t, imageBlock.ImageURL, "tripAgentLocationMarker.png")

}