feat(assessment): define corrective and training attempt contracts

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 10:36:16 +03:00
1 parent fade4e76e4
commit 20c03288d6
71 files changed
+14786 -1743

No files matched your search

@@ -573,7 +573,9 @@ const (
assessmentFinalizePath = assessmentAttemptPath + "/finalize"
assessmentResultPath = assessmentAttemptPath + "/result"
assessmentItemID = "01928f7a-4a10-7b2c-9d3e-5f6a7b8c9d01"
validAttemptCreate = `{"specialization":"backend","target_grade":"junior","task_language":"go"}`
validAttemptCreate = `{"kind":"root","specialization":"backend","target_grade":"junior","task_language":"go"}`
validCorrectiveCreate = `{"kind":"corrective","specialization":"backend","target_grade":"middle","task_language":"go","root_attempt_id":"01928f7a-3c4d-7e5f-8a9b-0c1d2e3f4a5b"}`
validExpressCreate = `{"kind":"demo_express"}`
)
// assessmentAnswerBody returns a SubmitMyAssessmentAnswer body for version 1
@@ -605,9 +607,27 @@ func TestAssessmentSchemaValidationPrecedesImplementation(t *testing.T) {
name: "create",
request: identityRequest{method: http.MethodPost, path: assessmentAttemptsPath, body: validAttemptCreate, headers: command},
},
{
name: "create a corrective attempt in an existing chain",
request: identityRequest{method: http.MethodPost, path: assessmentAttemptsPath, body: validCorrectiveCreate, headers: command},
},
{
name: "create a demo express training attempt",
request: identityRequest{method: http.MethodPost, path: assessmentAttemptsPath, body: validExpressCreate, headers: command},
},
{
name: "create without a kind discriminator",
request: identityRequest{method: http.MethodPost, path: assessmentAttemptsPath, body: `{"specialization":"backend","target_grade":"junior","task_language":"go"}`, headers: command},
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "express create with a real-assessment grade",
request: identityRequest{method: http.MethodPost, path: assessmentAttemptsPath, body: `{"kind":"demo_express","target_grade":"junior"}`, headers: command},
location: api.ProblemFieldLocationBody, pointer: "", code: "invalid",
},
{
name: "create without a task language choice",
request: identityRequest{method: http.MethodPost, path: assessmentAttemptsPath, body: `{"specialization":"network_engineer","target_grade":"middle","task_language":null}`, headers: command},
request: identityRequest{method: http.MethodPost, path: assessmentAttemptsPath, body: `{"kind":"root","specialization":"network_engineer","target_grade":"middle","task_language":null}`, headers: command},
},
{
// The server picks the mode from the published bank.