feat(privacy): complete the publication, hiding and preview settings screen
This commit is contained in:
1 parent
c2a8d17195
commit
5edff21d2d
28 files changed
+2230
-428
No files matched your search
@@ -1,17 +1,7 @@
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type {
|
||||
CardAccess,
|
||||
CardPreview,
|
||||
HiddenOrganization,
|
||||
PrivacyEventList,
|
||||
} from "../../../shared/api/schemas";
|
||||
import {
|
||||
CardAccessHistory,
|
||||
OrganizationVisibility,
|
||||
PrivacyHistory,
|
||||
PrivacyPreview,
|
||||
} from "./privacy-page";
|
||||
import type { CardAccess, HiddenOrganization, PrivacyEventList } from "../../../shared/api/schemas";
|
||||
import { CardAccessHistory, OrganizationVisibility, PrivacyHistory } from "./privacy-page";
|
||||
|
||||
const orgA = {
|
||||
id: "00000000-0000-4000-8000-000000000001",
|
||||
@@ -40,49 +30,56 @@ function hiddenOrganization(organization: typeof orgA): HiddenOrganization {
|
||||
}
|
||||
|
||||
describe("privacy page sections", () => {
|
||||
it("keeps the owner preview alias separate from organization aliases and category evidence", () => {
|
||||
const preview: CardPreview = {
|
||||
state: "published",
|
||||
fields: ["categories", "self_assessment"],
|
||||
card: {
|
||||
pseudonym: `cv1_${"a".repeat(43)}`,
|
||||
categories: [{ specialization: "backend", grade: "junior", strength: "standard" }],
|
||||
stack: null,
|
||||
self_assessment: [
|
||||
{
|
||||
specialization: "frontend",
|
||||
confirmation_status: "unconfirmed",
|
||||
declared_grade: "middle",
|
||||
},
|
||||
],
|
||||
experience_band: null,
|
||||
work_formats: null,
|
||||
salary_compatibility: null,
|
||||
},
|
||||
evidence: {
|
||||
items: [
|
||||
{
|
||||
skill: "backend",
|
||||
grade: "junior",
|
||||
trust: 1,
|
||||
basis: "synthetic_demo",
|
||||
calibration_status: "uncalibrated",
|
||||
observed_year: 2026,
|
||||
},
|
||||
],
|
||||
},
|
||||
generated_at: "2026-10-03T10:00:00Z",
|
||||
};
|
||||
it("shows who read the card and when, within the permitted detail", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<PrivacyPreview preview={preview} isLoading={false} error={null} onRetry={vi.fn()} />,
|
||||
<CardAccessHistory
|
||||
records={[
|
||||
accessRecord("00000000-0000-4000-8000-000000000051", orgA, "contact_read"),
|
||||
accessRecord("00000000-0000-4000-8000-000000000052", null),
|
||||
]}
|
||||
hiddenOrganizationIds={new Set([orgA.id])}
|
||||
isLoading={false}
|
||||
error={null}
|
||||
hasMore={false}
|
||||
isFetching={false}
|
||||
onLoad={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(markup).toContain("Предварительный псевдоним");
|
||||
expect(markup).toContain("Это отдельный псевдоним предпросмотра");
|
||||
expect(markup).toContain("Подтвержденные категории");
|
||||
expect(markup).toContain("Backend: Junior");
|
||||
expect(markup).toContain("Самооценка по направлениям");
|
||||
expect(markup).toContain("Frontend: Middle; грейд не подтвержден");
|
||||
expect(markup).toContain("Открыты контактные данные");
|
||||
expect(markup).toContain("Просмотрена карточка профиля");
|
||||
expect(markup).toContain("Компания А");
|
||||
expect(markup).toContain('dateTime="2026-10-01T10:00:00Z"');
|
||||
expect(markup).toContain("Организация не раскрывается");
|
||||
expect(markup).toContain("Сейчас профиль скрыт от этой организации");
|
||||
expect(markup).toContain("Сотрудники, запросы, фильтры и место в выдаче здесь не сохраняются");
|
||||
expect(markup).toContain("Показана вся история");
|
||||
});
|
||||
|
||||
it("shows an empty access history and an empty settings history", () => {
|
||||
const access = renderToStaticMarkup(
|
||||
<CardAccessHistory
|
||||
records={[]}
|
||||
isLoading={false}
|
||||
error={null}
|
||||
hasMore={false}
|
||||
isFetching={false}
|
||||
onLoad={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
const settings = renderToStaticMarkup(
|
||||
<PrivacyHistory
|
||||
events={[]}
|
||||
isLoading={false}
|
||||
error={null}
|
||||
hasMore={false}
|
||||
isFetching={false}
|
||||
onLoad={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(access).toContain("История доступа пока пуста");
|
||||
expect(settings).toContain("История настроек пока пуста");
|
||||
});
|
||||
|
||||
it("does not offer hide actions until the hidden list is fully loaded", () => {
|
||||
@@ -114,7 +111,7 @@ describe("privacy page sections", () => {
|
||||
"Список действий появится после загрузки всех страниц скрытых компаний",
|
||||
);
|
||||
expect(markup).not.toContain("Скрыть профиль</button>");
|
||||
expect(markup).toContain("не восстанавливает C4");
|
||||
expect(markup).toContain("не восстанавливают прежний доступ к контактам");
|
||||
});
|
||||
|
||||
it("shows only organizations from access history as hide candidates", () => {
|
||||
@@ -148,7 +145,7 @@ describe("privacy page sections", () => {
|
||||
expect(markup).toContain("Компания Б");
|
||||
expect(markup).toContain("Скрыть профиль");
|
||||
expect(markup).toContain("Загрузить ранние записи");
|
||||
expect(markup).toContain("Снятие скрытия само по себе не восстанавливает C4");
|
||||
expect(markup).toContain("новое приглашение и новое согласие C4");
|
||||
});
|
||||
|
||||
it("does not describe a partial history page as the complete history", () => {
|
||||
|
||||
Reference in new issue
Block a user