feat(frontend): edit projects and show semantic match evidence
This commit is contained in:
1 parent
5a731c25b7
commit
bc00d6901f
52 files changed
+2992
-111
No files matched your search
@@ -0,0 +1,70 @@
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { renderToString } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { AnonymousCardContent } from "../../../shared/api/schemas";
|
||||
import { matchCardQueryKeys } from "../api/card";
|
||||
import { CandidateCardDetails } from "./candidate-card-details";
|
||||
|
||||
const accountId = "11111111-1111-4111-8111-111111111111";
|
||||
const organizationId = "22222222-2222-4222-8222-222222222222";
|
||||
const handle = "cv1_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
||||
|
||||
const card: AnonymousCardContent = {
|
||||
pseudonym: handle,
|
||||
categories: null,
|
||||
stack: ["go"],
|
||||
self_assessment: null,
|
||||
experience_band: "3_6",
|
||||
work_formats: null,
|
||||
salary_compatibility: null,
|
||||
projects: [
|
||||
{
|
||||
title: "Платежный шлюз",
|
||||
description: "Проводки и сверки.\nВыплаты по расписанию.",
|
||||
stack: ["Go", "PostgreSQL"],
|
||||
repository_verified: true,
|
||||
},
|
||||
{ title: "Каталог", description: null, stack: [], repository_verified: false },
|
||||
],
|
||||
};
|
||||
|
||||
function render(content: AnonymousCardContent): string {
|
||||
const client = new QueryClient();
|
||||
client.setQueryData(matchCardQueryKeys.card(accountId, organizationId, handle), content);
|
||||
return renderToString(
|
||||
<QueryClientProvider client={client}>
|
||||
<CandidateCardDetails
|
||||
id="card-panel"
|
||||
accountId={accountId}
|
||||
organizationId={organizationId}
|
||||
candidateHandle={handle}
|
||||
open
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
).replaceAll("<!-- -->", "");
|
||||
}
|
||||
|
||||
describe("candidate card details", () => {
|
||||
it("lists the published projects with tags and a badge for a verified repository", () => {
|
||||
const html = render(card);
|
||||
|
||||
expect(html).toContain(">Проекты</h6>");
|
||||
expect(html).toContain("Платежный шлюз");
|
||||
expect(html).toContain("Выплаты по расписанию.");
|
||||
expect(html).toContain(">PostgreSQL<");
|
||||
expect(html.match(/Подтвержден публичным репозиторием/g)).toHaveLength(1);
|
||||
expect(html).toContain("Каталог");
|
||||
});
|
||||
|
||||
it("shows no address or link of a repository", () => {
|
||||
const html = render(card);
|
||||
|
||||
expect(html).not.toContain("github");
|
||||
expect(html).not.toMatch(/href="https?:/);
|
||||
});
|
||||
|
||||
it("shows no projects block while the card carries none", () => {
|
||||
expect(render({ ...card, projects: null })).not.toContain(">Проекты</h6>");
|
||||
expect(render({ ...card, projects: [] })).not.toContain(">Проекты</h6>");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user