feat: add assessment, privacy and support flows
This commit is contained in:
1 parent
ee3738ee73
commit
e4f24fa202
339 files changed
+56454
-1126
No files matched your search
@@ -2,8 +2,10 @@ import { QueryClientProvider } from "@tanstack/react-query";
|
||||
import { renderToString } from "react-dom/server";
|
||||
import { StaticRouterProvider, createStaticHandler, createStaticRouter } from "react-router-dom";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { assessmentQueryKeys } from "../../entities/assessment";
|
||||
import { getListMyConsentsQueryKey } from "../../shared/api/endpoints/consent/consent";
|
||||
import { getGetCurrentSessionQueryKey } from "../../shared/api/endpoints/identity/identity";
|
||||
import type { Session } from "../../shared/api/schemas";
|
||||
import { createQueryClient } from "../providers/query-client";
|
||||
import { routes } from "./routes";
|
||||
|
||||
@@ -20,7 +22,7 @@ async function render(path: string): Promise<string | Response> {
|
||||
const queryClient = createQueryClient();
|
||||
const scenario = path.startsWith("/employer") ? "employer" : "candidate";
|
||||
if (path.startsWith("/candidate") || path.startsWith("/employer")) {
|
||||
queryClient.setQueryData(getGetCurrentSessionQueryKey(), {
|
||||
const session = {
|
||||
account: {
|
||||
id: "11111111-1111-4111-8111-111111111111",
|
||||
email: "person@example.test",
|
||||
@@ -39,7 +41,17 @@ async function render(path: string): Promise<string | Response> {
|
||||
created_at: "2026-10-07T12:00:00Z",
|
||||
},
|
||||
csrf_token: "A".repeat(43),
|
||||
});
|
||||
} satisfies Session;
|
||||
queryClient.setQueryData(getGetCurrentSessionQueryKey(), session);
|
||||
if (path === "/candidate/assessment") {
|
||||
queryClient.setQueryData(assessmentQueryKeys.availability(session), { specializations: [] });
|
||||
queryClient.setQueryData(assessmentQueryKeys.questionnaire(session), {
|
||||
version: 0,
|
||||
specializations: [],
|
||||
work_context: null,
|
||||
updated_at: null,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (path.startsWith("/candidate/privacy")) {
|
||||
const hasMore = path.includes("history=partial");
|
||||
@@ -122,7 +134,23 @@ describe("route groups", () => {
|
||||
["/candidate/questionnaire", "Анкета", "Разделы кабинета кандидата"],
|
||||
["/candidate/onboarding", "Первые шаги", "Разделы кабинета кандидата"],
|
||||
["/candidate/privacy", "Согласия и настройки приватности", "Разделы кабинета кандидата"],
|
||||
["/candidate/assessment", "Проверка знаний", "Разделы кабинета кандидата"],
|
||||
[
|
||||
"/candidate/assessment/01928f7a-9c0d-7e1f-8a2b-3c4d5e6f7a80",
|
||||
"Попытка проверки",
|
||||
"Разделы кабинета кандидата",
|
||||
],
|
||||
["/employer/company", "Компания", "Разделы кабинета работодателя"],
|
||||
["/employer/needs", "Потребности", "Разделы кабинета работодателя"],
|
||||
["/candidate/support/cases", "Мои обращения", "Разделы кабинета кандидата"],
|
||||
["/candidate/support/cases/new", "Обратиться в поддержку", "Разделы кабинета кандидата"],
|
||||
[
|
||||
"/candidate/support/cases/manual-assessment",
|
||||
"Запросить ручную оценку",
|
||||
"Разделы кабинета кандидата",
|
||||
],
|
||||
["/employer/support/cases", "Мои обращения", "Разделы кабинета работодателя"],
|
||||
["/employer/support/cases/new", "Обратиться в поддержку", "Разделы кабинета работодателя"],
|
||||
["/employer/candidates", "Кандидаты", "Разделы кабинета работодателя"],
|
||||
])("renders %s in its shell with one h1 and landmarks", async (path, heading, navLabel) => {
|
||||
const html = await renderHtml(path);
|
||||
@@ -183,6 +211,14 @@ describe("route groups", () => {
|
||||
});
|
||||
|
||||
describe("product readiness", () => {
|
||||
it("keeps the training run available when no full-assessment category exists", async () => {
|
||||
const html = await renderHtml("/candidate/assessment");
|
||||
|
||||
expect(html).toContain("Сначала выберите специализацию");
|
||||
expect(html).toContain("Начать демонстрацию");
|
||||
expect(html).not.toContain("Начать полную проверку");
|
||||
});
|
||||
|
||||
it("presents the root page as a scaffold, not as a working product", async () => {
|
||||
const html = await renderHtml("/");
|
||||
|
||||
@@ -226,7 +262,7 @@ describe("product readiness", () => {
|
||||
});
|
||||
|
||||
it("labels the remaining cabinet scaffolds as placeholders", async () => {
|
||||
for (const path of ["/candidate", "/employer/needs"]) {
|
||||
for (const path of ["/candidate", "/employer/candidates"]) {
|
||||
expect(await renderHtml(path)).toContain("Экран будет реализован в одной из следующих задач");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user