Improve audit pipeline and outreach review
This commit is contained in:
@@ -227,6 +227,124 @@ test("buildAuditEvidenceInput preserves screenshot references without base64 pay
|
||||
}
|
||||
});
|
||||
|
||||
test("buildAuditEvidenceInput creates stable evidence ledger refs for source facts", () => {
|
||||
const first = buildAuditEvidenceInput({
|
||||
crawlPages: [
|
||||
{
|
||||
sourceUrl: "https://example.com",
|
||||
finalUrl: "https://example.com/",
|
||||
pageKind: "homepage",
|
||||
title: "Startseite",
|
||||
metaDescription: "Bäckerei Muster in Berlin",
|
||||
visibleTextExcerpt: "Bäckerei Muster Berlin mit Kontakt und Öffnungszeiten.",
|
||||
hasContactCtaSignal: true,
|
||||
},
|
||||
],
|
||||
technicalChecks: [
|
||||
{
|
||||
sourceUrl: "https://example.com",
|
||||
finalUrl: "https://example.com/",
|
||||
usesHttps: true,
|
||||
missingMetaDescription: false,
|
||||
hasVisibleContactPath: true,
|
||||
brokenInternalLinkCount: 0,
|
||||
},
|
||||
],
|
||||
screenshots: [
|
||||
{
|
||||
storageId: "storage-home-mobile",
|
||||
sourceUrl: "https://example.com",
|
||||
viewport: "mobile",
|
||||
width: 390,
|
||||
height: 844,
|
||||
mimeType: "image/png",
|
||||
capturedAt: 1_700_000_001_000,
|
||||
},
|
||||
],
|
||||
pageSpeedInputs: [
|
||||
{
|
||||
strategy: "mobile",
|
||||
status: "succeeded",
|
||||
sourceUrl: "https://example.com",
|
||||
normalized: {
|
||||
implications: [
|
||||
"Die wichtigsten Inhalte erscheinen auf dem Smartphone spürbar verzögert.",
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
externalMarkdown:
|
||||
"# Startseite\nBäckerei Muster Berlin. Telefon und Öffnungszeiten sind sichtbar.",
|
||||
skillRegistry: SAMPLE_SKILL_REGISTRY,
|
||||
});
|
||||
const second = buildAuditEvidenceInput({
|
||||
...first,
|
||||
crawlPages: [
|
||||
{
|
||||
sourceUrl: "https://example.com",
|
||||
finalUrl: "https://example.com/",
|
||||
pageKind: "homepage",
|
||||
title: "Startseite",
|
||||
metaDescription: "Bäckerei Muster in Berlin",
|
||||
visibleTextExcerpt: "Bäckerei Muster Berlin mit Kontakt und Öffnungszeiten.",
|
||||
hasContactCtaSignal: true,
|
||||
},
|
||||
],
|
||||
technicalChecks: [
|
||||
{
|
||||
sourceUrl: "https://example.com",
|
||||
finalUrl: "https://example.com/",
|
||||
usesHttps: true,
|
||||
missingMetaDescription: false,
|
||||
hasVisibleContactPath: true,
|
||||
brokenInternalLinkCount: 0,
|
||||
},
|
||||
],
|
||||
screenshots: [
|
||||
{
|
||||
storageId: "storage-home-mobile",
|
||||
sourceUrl: "https://example.com",
|
||||
viewport: "mobile",
|
||||
width: 390,
|
||||
height: 844,
|
||||
mimeType: "image/png",
|
||||
capturedAt: 1_700_000_001_000,
|
||||
},
|
||||
],
|
||||
pageSpeedInputs: [
|
||||
{
|
||||
strategy: "mobile",
|
||||
status: "succeeded",
|
||||
sourceUrl: "https://example.com",
|
||||
normalized: {
|
||||
implications: [
|
||||
"Die wichtigsten Inhalte erscheinen auf dem Smartphone spürbar verzögert.",
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
externalMarkdown:
|
||||
"# Startseite\nBäckerei Muster Berlin. Telefon und Öffnungszeiten sind sichtbar.",
|
||||
});
|
||||
|
||||
assert.deepEqual(first.evidenceLedger, second.evidenceLedger);
|
||||
const evidenceTypes = new Set(first.evidenceLedger.map((entry) => entry.type));
|
||||
for (const type of [
|
||||
"crawl_page",
|
||||
"technical_check",
|
||||
"screenshot",
|
||||
"pagespeed",
|
||||
"jina_excerpt",
|
||||
] as const) {
|
||||
assert.equal(evidenceTypes.has(type), true, `${type} evidence should exist.`);
|
||||
}
|
||||
assert.equal(
|
||||
first.evidenceLedger.every((entry) => entry.id.includes("unknown") === false),
|
||||
true,
|
||||
"Evidence IDs should be stable source refs, not unknown placeholders.",
|
||||
);
|
||||
});
|
||||
|
||||
test("buildAuditEvidenceInput converts PageSpeed implications into sanitized customer-facing text", () => {
|
||||
const actual = buildAuditEvidenceInput({
|
||||
pageSpeedInputs: [
|
||||
@@ -421,15 +539,16 @@ test("buildAuditEvidenceInput prioritizes local-audit v3 skills before cap", ()
|
||||
const selectedIds = new Set(actual.selectedSkills.map((skill) => skill.id));
|
||||
assert.deepEqual(actual.selectedSkills.map((skill) => skill.id), [
|
||||
"visual-design",
|
||||
"impeccable-critique",
|
||||
"contact-conversion",
|
||||
"local-seo-basics",
|
||||
"performance-experience",
|
||||
"mobile-usability",
|
||||
"conversion-copy",
|
||||
]);
|
||||
assert.equal(actual.selectedSkills.length, 6);
|
||||
for (const id of [
|
||||
"visual-design",
|
||||
"impeccable-critique",
|
||||
"contact-conversion",
|
||||
"local-seo-basics",
|
||||
"performance-experience",
|
||||
@@ -475,6 +594,7 @@ test("buildAuditEvidenceInput gates v3 skills when declared inputs are missing",
|
||||
const selectedIds = new Set(actual.selectedSkills.map((skill) => skill.id));
|
||||
for (const id of [
|
||||
"visual-design",
|
||||
"impeccable-critique",
|
||||
"first-impression-clarity",
|
||||
"contact-conversion",
|
||||
"mobile-usability",
|
||||
|
||||
Reference in New Issue
Block a user