| 1 | package slack |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/stretchr/testify/assert" |
| 7 | ) |
| 8 | |
| 9 | func TestNewImageBlock(t *testing.T) { |
| 10 | |
| 11 | imageText := NewTextBlockObject("plain_text", "Location", false, false) |
| 12 | imageBlock := NewImageBlock("https://api.slack.com/img/blocks/bkb_template_images/tripAgentLocationMarker.png", "Marker", "test", imageText) |
| 13 | |
| 14 | assert.Equal(t, string(imageBlock.Type), "image") |
| 15 | assert.Equal(t, imageBlock.Title.Type, "plain_text") |
| 16 | assert.Equal(t, imageBlock.BlockID, "test") |
| 17 | assert.Contains(t, imageBlock.Title.Text, "Location") |
| 18 | assert.Contains(t, imageBlock.ImageURL, "tripAgentLocationMarker.png") |
| 19 | |
| 20 | } |