File: block_context_test.go

package info (click to toggle)
golang-github-slack-go-slack 0.11.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,720 kB
  • sloc: makefile: 54
file content (21 lines) | stat: -rw-r--r-- 651 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)

}