-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable_title_test.go
36 lines (30 loc) · 1.07 KB
/
table_title_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package textractor
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestTableTitle(t *testing.T) {
t.Run("Words", func(t *testing.T) {
// Create a TableTitle with some words
words := []*Word{
{base: base{id: "1", confidence: 0.9, blockType: "Word"}, text: "Hello"},
{base: base{id: "2", confidence: 0.8, blockType: "Word"}, text: "World"},
}
tableTitle := &TableTitle{base: base{id: "tableTitle", confidence: 0.95, blockType: "TableTitle"}, words: words}
// Test the Words method
result := tableTitle.Words()
assert.Equal(t, words, result)
})
t.Run("Text", func(t *testing.T) {
// Create a TableTitle with some words
words := []*Word{
{base: base{id: "1", confidence: 0.9, blockType: "Word"}, text: "Hello"},
{base: base{id: "2", confidence: 0.8, blockType: "Word"}, text: "World"},
}
tableTitle := &TableTitle{base: base{id: "tableTitle", confidence: 0.95, blockType: "TableTitle"}, words: words}
// Test the Text method
result := tableTitle.Text()
expectedText := "Hello World"
assert.Equal(t, expectedText, result)
})
}