Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions internal/app/screen_inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ func (im *inspectorModel) refreshWorkflows() {
func (im *inspectorModel) ensureWorkflows() {
if len(im.workflows) == 0 {
im.refreshWorkflows()
return
}
im.refreshWorkflows()
}

func (im *inspectorModel) Enter(m *Model) {
Expand Down
34 changes: 34 additions & 0 deletions internal/app/screen_inspector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,42 @@ package app
import (
"testing"
"unicode/utf8"

"unic/internal/inspector"
)

func TestInspectorEnsureWorkflowsKeepsExistingWorkflows(t *testing.T) {
im := inspectorModel{
workflows: []inspector.Workflow{
{
Kind: inspector.WorkflowSecurity,
Title: "Existing Workflow",
Description: "already loaded",
Available: true,
},
},
}

im.ensureWorkflows()

if len(im.workflows) != 1 {
t.Fatalf("expected existing workflow list to be preserved, got %d workflows", len(im.workflows))
}
if im.workflows[0].Title != "Existing Workflow" {
t.Fatalf("expected existing workflow to be preserved, got %#v", im.workflows[0])
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

func TestInspectorEnsureWorkflowsRefreshesEmptyWorkflows(t *testing.T) {
im := inspectorModel{}

im.ensureWorkflows()

if len(im.workflows) != 2 {
t.Fatalf("expected empty workflow list to be populated with 2 workflows, got %d", len(im.workflows))
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

func TestInspectorShortenHandlesUnicodeSafely(t *testing.T) {
tests := []struct {
name string
Expand Down
Loading