46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package career
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"my-homelab-configs/cmd/nextpath/internal/assessment"
|
|
)
|
|
|
|
func TestDefaultCatalogRanksInterestFitWithoutClaimingEmployability(t *testing.T) {
|
|
catalog, err := DefaultCatalog()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
result := assessment.Result{Scores: []assessment.DimensionScore{
|
|
{Dimension: assessment.Investigative, Percent: 100},
|
|
{Dimension: assessment.Conventional, Percent: 80},
|
|
{Dimension: assessment.Artistic, Percent: 70},
|
|
{Dimension: assessment.Realistic, Percent: 20},
|
|
{Dimension: assessment.Social, Percent: 10},
|
|
{Dimension: assessment.Enterprising, Percent: 0},
|
|
}}
|
|
matches := Rank(result, catalog, 3)
|
|
if len(matches) != 3 {
|
|
t.Fatalf("matches = %d, want 3", len(matches))
|
|
}
|
|
if matches[0].Occupation.ONETSOC != "15-1252.00" {
|
|
t.Fatalf("first match = %s, want Software Developer", matches[0].Occupation.Title)
|
|
}
|
|
if matches[0].FitScore != 88 {
|
|
t.Fatalf("fit score = %d, want 88", matches[0].FitScore)
|
|
}
|
|
if matches[0].Notice == "" {
|
|
t.Fatal("match omitted its market-evidence boundary")
|
|
}
|
|
}
|
|
|
|
func TestRankIsDeterministicForTies(t *testing.T) {
|
|
catalog, _ := DefaultCatalog()
|
|
matches := Rank(assessment.Result{}, catalog, len(catalog.Occupations))
|
|
for index := 1; index < len(matches); index++ {
|
|
if matches[index-1].Occupation.Title > matches[index].Occupation.Title {
|
|
t.Fatal("zero-score ties are not ordered by title")
|
|
}
|
|
}
|
|
}
|