Skip to content

Commit

Permalink
Actually call the correct numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanratcliffe committed Jun 21, 2024
1 parent 6373b69 commit 472f3e8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
32 changes: 32 additions & 0 deletions cmd/plan_mapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,35 @@ func TestMappedItemDiffsFromPlan(t *testing.T) {
t.Errorf("Expected secret query scope to be 'dogfood.default', got '%v'", secret.GetMappingQuery().GetScope())
}
}

func TestPlanMappingResultNumFuncs(t *testing.T) {
result := PlanMappingResult{
Results: []PlannedChangeMapResult{
{
Status: MapStatusSuccess,
},
{
Status: MapStatusSuccess,
},
{
Status: MapStatusNotEnoughInfo,
},
{
Status: MapStatusUnsupported,
},
},
}

if result.NumSuccess() != 2 {
t.Errorf("Expected 2 success, got %v", result.NumSuccess())
}

if result.NumNotEnoughInfo() != 1 {
t.Errorf("Expected 1 not enough info, got %v", result.NumNotEnoughInfo())
}

if result.NumUnsupported() != 1 {
t.Errorf("Expected 1 unsupported, got %v", result.NumUnsupported())
}

}
5 changes: 2 additions & 3 deletions cmd/tea_submitplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ func (m submitPlanModel) submitPlanCmd() tea.Msg {
m.processing <- submitPlanUpdateMsg{m.resourceExtractionTask.UpdateStatusMsg(taskStatusRunning)}
time.Sleep(time.Second)


m.processing <- submitPlanUpdateMsg{m.resourceExtractionTask.UpdateTitleMsg(
"Extracting 13 changing resources: 4 supported 9 unsupported",
)}
Expand Down Expand Up @@ -491,8 +490,8 @@ func (m submitPlanModel) submitPlanCmd() tea.Msg {
m.processing <- submitPlanUpdateMsg{m.resourceExtractionTask.UpdateTitleMsg(
fmt.Sprintf("Extracting %v changing resources: %v supported %v skipped %v unsupported",
mappingResponse.NumTotal(),
mappingResponse.NumUnsupported(),
mappingResponse.NumUnsupported(),
mappingResponse.NumSuccess(),
mappingResponse.NumNotEnoughInfo(),
mappingResponse.NumUnsupported(),
))}

Expand Down

0 comments on commit 472f3e8

Please sign in to comment.