-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_test.go
More file actions
71 lines (54 loc) · 1.64 KB
/
init_test.go
File metadata and controls
71 lines (54 loc) · 1.64 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package devtui
import (
"testing"
)
func TestNewTUI(t *testing.T) {
// Test configuration with default tabs
config := &TuiConfig{
Color: &ColorPalette{}, // Usando un ColorPalette vacío
Logger: func(messages ...any) {
// Mock function for logging
},
}
tui := NewTUI(config)
// Check if TUI was created correctly
if tui == nil {
t.Fatal("TUI was not created correctly")
}
// Since internal fields are not accessible in real usage, we can only test
// that the TUI was created successfully.
// NewTUI should not add any default tabs anymore.
if len(tui.TabSections) != 0 {
t.Errorf("Expected 0 tab sections after NewTUI, got %d", len(tui.TabSections))
}
}
func TestMultipleTabSections(t *testing.T) {
// Test that NewTUI correctly adds multiple tab sections
config := &TuiConfig{
Color: &ColorPalette{},
}
tui := NewTUI(config)
// Enable test mode for synchronous execution
tui.SetTestMode(true)
// Create two more sections using NewTabSection
tui.NewTabSection("Tab1", "Description 1")
tui.NewTabSection("Tab2", "Description 2")
totalSections := len(tui.TabSections)
// Expected: 2 (Tab1, Tab2)
expected := 2
if totalSections != expected {
t.Errorf("Expected %d tab sections, got %d", expected, totalSections)
}
}
func TestChannelFunctionality(t *testing.T) {
// Since the channel is internal to the TUI, we can't directly test it
// This test should be modified to test observable behavior or removed
config := &TuiConfig{
Color: &ColorPalette{},
}
tui := NewTUI(config)
// We can only test that the TUI was created successfully
if tui == nil {
t.Error("Failed to create TUI with channel functionality")
}
}