fix(assessment): return confirmed categories with their basis and label demonstration categories

This commit is contained in:
shira committed 2026-10-09 21:24:24 +03:00
1 parent 623d41b969
commit d4903a3796
77 files changed
+1441 -288

No files matched your search

+7 -2
View File
@@ -327,7 +327,10 @@ function scenarioAnswer(scenario: Scenario, pathname: string): Stub {
};
case "/api/v1/me/profile":
// The home reads only the version; the profile form is not opened here.
return { status: 200, body: { version: scenario.profileVersion ?? 0 } };
return {
status: 200,
body: { version: scenario.profileVersion ?? 0, confirmed_categories: [] },
};
case "/api/v1/me/questionnaire":
return {
status: 200,
@@ -357,6 +360,7 @@ function scenarioAnswer(scenario: Scenario, pathname: string): Stub {
{
specialization: declared.specialization,
confirmed_grade: scenario.confirmed ?? null,
confirmed_basis: scenario.confirmed ? "synthetic_demo" : null,
active_attempt_id: null,
grades: [
{
@@ -438,13 +442,14 @@ test.describe("candidate home states with a stubbed API", () => {
await captureReviewScreenshots(page, "candidate-home-category");
});
test("states one confirmed category in every block when the availability read has none", async ({
test("states one confirmed category in every block when the availability confirms it", async ({
page,
}) => {
await mockCandidateApi(page, {
step: "candidate_consents",
profileVersion: 1,
declared: { specialization: "backend", grade: "junior" },
confirmed: "junior",
results: [realResult("confirmed")],
});
await page.goto("/candidate");
+11 -4
View File
@@ -495,7 +495,7 @@ function confirmedEntry(handle: string, grade: string, coverage: number, overrid
specialization: "backend",
confirmation_status: "confirmed",
declared_grade: "senior",
category: { specialization: "backend", grade },
category: { specialization: "backend", grade, basis: "synthetic_demo" },
strength: "strong",
public_context: {
stack: ["go", "postgresql"],
@@ -715,7 +715,14 @@ async function installFakeApi(page: Page, options: FakeOptions = {}): Promise<Fa
200,
options.card ?? {
pseudonym: cardMatch[1],
categories: [{ specialization: "backend", grade: "middle", strength: "strong" }],
categories: [
{
specialization: "backend",
grade: "middle",
strength: "strong",
basis: "synthetic_demo",
},
],
stack: ["go"],
self_assessment: [
{
@@ -795,7 +802,7 @@ test.describe("employer candidate search with a stubbed API", () => {
// The confirmed and the declared grade have separate lines.
const confirmed = groupSection(page, "Подтвержденные").getByRole("article");
await expect(confirmed).toContainText("Грейд подтвержден: Middle");
await expect(confirmed).toContainText("Backend, Middle. Сильное подтверждение");
await expect(confirmed).toContainText("Backend, Middle. Демонстрационное подтверждение");
await expect(confirmed).toContainText("Заявленный кандидатом грейд");
await expect(confirmed).toContainText("Senior");
@@ -956,7 +963,7 @@ test.describe("employer candidate search with a stubbed API", () => {
const open = confirmed.getByRole("button", { name: /карточку/ });
await open.click();
const panel = confirmed.getByRole("region", { name: "Карточка кандидата" });
await expect(panel.getByText("Backend: Middle. Сильное подтверждение")).toBeVisible();
await expect(panel.getByText("Backend: Middle. Демонстрационное подтверждение")).toBeVisible();
await expect(panel.getByText("Заявлено: Junior")).toBeVisible();
await expect(panel.getByText("Backend: Middle").first()).toBeVisible();
await expect(panel.getByText("Год оценки")).toBeVisible();