Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
35 changes: 35 additions & 0 deletions internal/app/screen_inspector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,43 @@ package app
import (
"testing"
"unicode/utf8"

"unic/internal/inspector"
)

func TestInspectorEnsureWorkflowsKeepsExistingWorkflows(t *testing.T) {
im := inspectorModel{
checklistPath: "new-checklist.yaml",
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) == 0 {
t.Fatal("expected empty workflow list to be populated")
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

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