| 1 | package slack |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/stretchr/testify/assert" |
| 7 | ) |
| 8 | |
| 9 | func TestNewContextBlock(t *testing.T) { |
| 10 | |
| 11 | locationPinImage := NewImageBlockElement("https://api.slack.com/img/blocks/bkb_template_images/tripAgentLocationMarker.png", "Location Pin Icon") |
| 12 | textExample := NewTextBlockObject("plain_text", "Location: Central Business District", true, false) |
| 13 | |
| 14 | elements := []MixedElement{locationPinImage, textExample} |
| 15 | |
| 16 | contextBlock := NewContextBlock("test", elements...) |
| 17 | assert.Equal(t, string(contextBlock.Type), "context") |
| 18 | assert.Equal(t, contextBlock.BlockID, "test") |
| 19 | assert.Equal(t, len(contextBlock.ContextElements.Elements), 2) |
| 20 | |
| 21 | } |