feat(invitations): add the candidate invitation inbox with C4 acceptance and decline

This commit is contained in:
shira committed 2026-10-09 20:30:35 +03:00
1 parent 12a7213d4a
commit a856066316
54 files changed
+3897 -136

No files matched your search

@@ -0,0 +1,50 @@
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vitest";
import {
candidateInvitationFixture,
contactConsentOffer,
} from "../../../entities/invitation/testing";
import { AcceptContactConsentForm } from "./accept-contact-consent-form";
function render(): string {
return renderToStaticMarkup(
<AcceptContactConsentForm
invitation={candidateInvitationFixture()}
offer={contactConsentOffer}
organizationName="Северный ветер"
csrfToken={"A".repeat(43)}
onAccepted={() => undefined}
onFailure={() => undefined}
/>,
);
}
describe("accept contact consent form", () => {
it("offers each kind the profile holds as a separate, unchecked choice", () => {
const html = render();
for (const label of ["ФИО", "Электронная почта", "Телефон"]) {
expect(html).toContain(`<span>${label}</span>`);
}
expect(html).not.toContain("<span>Telegram</span>");
expect(html.match(/type="checkbox"/g)).toHaveLength(4);
expect(html).not.toMatch(/checked=""/);
});
it("shows the consent text as paragraphs and the organization in the confirmation", () => {
const html = render();
expect(html).toContain("<p>Я согласен передать компании «Северный ветер» отмеченные контакты");
expect(html).toContain("<p>Согласие относится только к этому приглашению.</p>");
expect(html).toContain("Я прочитал(а) текст согласия и согласен(на) передать");
});
it("is not ready to send until a kind and the confirmation are chosen", () => {
const html = render();
expect(html).toMatch(
/<button[^>]*aria-disabled="true"[^>]*>Принять и передать контакты<\/button>/,
);
expect(html).not.toContain('role="alert"');
});
});