fix(assessment): return confirmed categories with their basis and label demonstration categories
This commit is contained in:
1 parent
623d41b969
commit
d4903a3796
77 files changed
+1441
-288
No files matched your search
@@ -144,6 +144,7 @@ func TestAnonymousCandidateViewUsesPublishedAllowlist(t *testing.T) {
|
||||
AsOf: time.Date(2026, 10, 6, 0, 0, 0, 0, time.UTC),
|
||||
ConfirmedCategories: []CandidateViewConfirmedCategoryInput{{
|
||||
Specialization: SpecializationBackend, Grade: GradeMiddle, Strength: CandidateViewStrengthStrong,
|
||||
Basis: AssessmentCategorySourceSyntheticDemo,
|
||||
}},
|
||||
WorkFormats: []QuestionnaireWorkFormat{QuestionnaireWorkFormatRemote, QuestionnaireWorkFormatHybrid},
|
||||
})
|
||||
@@ -250,6 +251,7 @@ func TestAnonymousCandidateViewKeepsCategoriesSeparateFromSelfAssessment(t *test
|
||||
}
|
||||
category := CandidateViewConfirmedCategoryInput{
|
||||
Specialization: SpecializationBackend, Grade: GradeMiddle, Strength: CandidateViewStrengthStandard,
|
||||
Basis: AssessmentCategorySourceSyntheticDemo,
|
||||
}
|
||||
newView := func(field CardField) AnonymousCandidateViewDTO {
|
||||
t.Helper()
|
||||
@@ -417,3 +419,24 @@ func containsCandidateViewSkill(skills []CandidateViewSkillCode, wanted Candidat
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// A category without a known basis would read as a real confirmation, so the
|
||||
// anonymous view refuses it instead of defaulting the basis.
|
||||
func TestAnonymousCandidateViewRequiresTheBasisOfEveryCategory(t *testing.T) {
|
||||
fields, err := NewCardFieldSet([]CardField{CardFieldCategories})
|
||||
if err != nil {
|
||||
t.Fatalf("NewCardFieldSet() error = %v", err)
|
||||
}
|
||||
for _, basis := range []AssessmentCategorySource{"", "real"} {
|
||||
_, err := NewAnonymousCandidateView(CandidateViewInput{
|
||||
Pseudonym: candidateViewTestPseudonym(t, uuid.New(), uuid.New()), PublishedFields: fields,
|
||||
AsOf: time.Date(2026, 10, 6, 0, 0, 0, 0, time.UTC),
|
||||
ConfirmedCategories: []CandidateViewConfirmedCategoryInput{{
|
||||
Specialization: SpecializationBackend, Grade: GradeJunior, Strength: CandidateViewStrengthStandard, Basis: basis,
|
||||
}},
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatalf("NewAnonymousCandidateView(basis %q) error = nil, want rejection", basis)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user