mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-10-03 02:04:31 +10:00
test(tooling): cover visible website labels
This commit is contained in:
@@ -34,7 +34,7 @@ const expectedTokens: readonly ExpectedToken[] = [
|
||||
"mirakova.dev",
|
||||
"orbit-field-omega",
|
||||
].map((value) => token(value, "header")),
|
||||
...["Profiles", "OrbitNet", "orbit-profile-omega"].map((value) => token(value, "profiles")),
|
||||
...["Profiles", "OrbitNet", "orbit-profile-omega", "orbit.example/profile"].map((value) => token(value, "profiles")),
|
||||
...["Summary"].map((value) => token(value, "summary")),
|
||||
...[text(SUMMARY_HTML)].map((value) => token(value, "summary")),
|
||||
...["Experience"].map((value) => token(value, "experience")),
|
||||
@@ -48,6 +48,7 @@ const expectedTokens: readonly ExpectedToken[] = [
|
||||
"Principal Reliability Engineer",
|
||||
"2021 / Present",
|
||||
text(EXPERIENCE_ROLE_TWO_HTML),
|
||||
"northstar.example/jobs",
|
||||
].map((value) => token(value, "experience")),
|
||||
...["Education"].map((value) => token(value, "education")),
|
||||
...[
|
||||
@@ -58,6 +59,7 @@ const expectedTokens: readonly ExpectedToken[] = [
|
||||
"2014 — 2018 (long academic period)",
|
||||
"東京",
|
||||
text(EDUCATION_HTML),
|
||||
"u-tokyo.example/program",
|
||||
].map((value) => token(value, "education")),
|
||||
...["Skills", "TypeScript", "Advanced", "skill-keyword-alpha", "Kubernetes", "Expert", "skill-keyword-beta"].map(
|
||||
(value) => token(value, "skills"),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { evaluateExport } from "./metrics";
|
||||
import { createSyntheticCorpus } from "./fixture";
|
||||
import { evaluateExport, tokenize } from "./metrics";
|
||||
|
||||
const corpus = {
|
||||
name: "synthetic",
|
||||
@@ -60,6 +61,24 @@ describe("evaluateExport", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it.each(["orbit.example/profile", "northstar.example/jobs", "u-tokyo.example/program"] as const)(
|
||||
"fails when visible website label %s drops while link targets remain correct",
|
||||
(label) => {
|
||||
const corpus = createSyntheticCorpus("full-width");
|
||||
const paragraphs = corpus.tokens.map((entry) => entry.value);
|
||||
const baseline = evaluateExport(corpus, { paragraphs, links: corpus.links });
|
||||
const dropped = evaluateExport(corpus, {
|
||||
paragraphs: paragraphs.map((paragraph) => (paragraph === label ? "" : paragraph)),
|
||||
links: corpus.links,
|
||||
});
|
||||
|
||||
expect(baseline.links.missing).toEqual([]);
|
||||
expect(baseline.links.unexpected).toEqual([]);
|
||||
expect(dropped.links).toEqual(baseline.links);
|
||||
expect(dropped.duplicates.observed).toBe(baseline.duplicates.observed - tokenize(label).length);
|
||||
},
|
||||
);
|
||||
|
||||
it("detects a dropped token and an inverted pair", () => {
|
||||
const result = evaluateExport(corpus, {
|
||||
paragraphs: ["Bravo", "Alpha"],
|
||||
|
||||
Reference in New Issue
Block a user