Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions shared/promise-audit.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const fixPackCheckoutSource = readFileSync(new URL("../src/fix-pack-checkout.js"
const appSource = readFileSync(new URL("../src/App.jsx", import.meta.url), "utf8");
const mainSource = readFileSync(new URL("../src/main.jsx", import.meta.url), "utf8");
const reportsSource = readFileSync(new URL("../worker/routes/reports.js", import.meta.url), "utf8");
const reportDataSource = readFileSync(new URL("../worker/lib/report-data.js", import.meta.url), "utf8");
const serverEngineSource = readFileSync(new URL("../server/audit/engine.js", import.meta.url), "utf8");
const migrationsDir = new URL("../migrations", import.meta.url);
const allMigrations = readdirSync(migrationsDir)
Expand Down Expand Up @@ -522,3 +523,36 @@ test("README sitemap inventory claim keeps rendered repair proof separate", () =
assert.match(crawlInventorySource, /CRAWLRAVEN_PUBLIC_CRAWL_PAGES|50000/, "inventory cap is 50,000 URLs");
assert.ok(migrationHas("large_crawl_url_proofs"), "large-crawl proof stored separately");
});

test("README queued-job claim matches status polling before the private report loads", () => {
assert.match(liveSection, /Queued audit jobs backed by D1 `audit_jobs`, with status polling before the private report loads/i);
assert.match(appSource, /async function pollAuditJob/, "the UI polls job status before the report loads");
assert.match(appSource, /\/api\/audit\/jobs\//, "polling hits the job status endpoint");
Comment on lines +529 to +530

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert that the polling helper is actually called

If the queued-audit submission path stops invoking pollAuditJob, these assertions still pass because they only find the unused helper declaration and the URL inside that helper. The test therefore does not protect the README claim that polling occurs before loading the private report; it should also pin the call from the queued response path, ideally together with its ordering before report loading.

AGENTS.md reference: AGENTS.md:L7-L7

Useful? React with 👍 / 👎.

});

test("README saved-report claim matches owner email and invite-bound ownership", () => {
assert.match(
liveSection,
/Saved private report URLs backed by D1 `audit_reports`, tied to the beta owner email and invite where available/i
);
assert.match(
reportDataSource,
/INSERT INTO audit_reports[\s\S]*owner_email[\s\S]*owner_invite_id/,
"reports are stored with owner email and invite id"
);
assert.match(auditsSource, /owner_invite_id: access\.inviteId/, "queued audits carry the owner invite");
Comment on lines +539 to +543

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify ownership values are bound into saved reports

If the report insert continues naming owner_email and owner_invite_id but its .bind(...) values are changed to blanks, nulls, or unrelated fields, this test still passes; the separate queued-job assertion does not verify what saveAuditReportWithContext stores. That leaves the promised owner-bound report behavior unprotected, so the test should exercise the save operation or pin the corresponding bound access values.

AGENTS.md reference: AGENTS.md:L7-L7

Useful? React with 👍 / 👎.

});

test("README public support, terms, and privacy pages keep no-ranking-guarantee copy", () => {
assert.match(
liveSection,
/Public `\/support`, `\/terms`, and `\/privacy` pages with no ranking guarantees/i
);
assert.match(pagesSource, /No ranking or traffic guarantee/, "terms page carries no ranking guarantee");
assert.match(pagesSource, /No ranking, traffic, or revenue promise is made/, "privacy page carries no ranking promise");
assert.match(
pagesSource,
/No ranking, indexing, traffic, revenue, or search-engine outcome is promised/,
Comment on lines +551 to +555

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check the disclaimer on each claimed policy page

These matches search the entire pages.js module rather than the rendered page named by each assertion: the first phrase is in packagesHtml, the second is in supportHtml, and the third is in termsHtml, while privacyHtml currently has no no-ranking disclaimer at all. Consequently the test passes even though the privacy page does not satisfy the README claim and would keep passing if these phrases moved between pages; render supportHtml, termsHtml, and privacyHtml separately and assert against each result.

AGENTS.md reference: AGENTS.md:L7-L7

Useful? React with 👍 / 👎.

"support page carries no ranking promise"
);
});
Loading