Codebase list golang-github-nlopes-slack / f282e598-9350-4d40-ba4b-90cbf2cd4600/v0.6.0 block_context_test.go
f282e598-9350-4d40-ba4b-90cbf2cd4600/v0.6.0

Tree @f282e598-9350-4d40-ba4b-90cbf2cd4600/v0.6.0 (Download .tar.gz)

block_context_test.go @f282e598-9350-4d40-ba4b-90cbf2cd4600/v0.6.0raw · history · blame

package slack

import (
	"testing"

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

func TestNewContextBlock(t *testing.T) {

	locationPinImage := NewImageBlockElement("https://api.slack.com/img/blocks/bkb_template_images/tripAgentLocationMarker.png", "Location Pin Icon")
	textExample := NewTextBlockObject("plain_text", "Location: Central Business District", true, false)

	elements := []MixedElement{locationPinImage, textExample}

	contextBlock := NewContextBlock("test", elements...)
	assert.Equal(t, string(contextBlock.Type), "context")
	assert.Equal(t, contextBlock.BlockID, "test")
	assert.Equal(t, len(contextBlock.ContextElements.Elements), 2)

}