Untested reject branches in search, safe-fetch and schema-check, and no guide-page test

Aperta Adatta ai principianti
#266 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
83/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
backend, testing

Direzione di ricerca

Inizia da site/lib/lib.test.mjs e dalle funzioni indicate in site/lib/search.mjs, safe-fetch.mjs, schema-check.mjs, guide-page.mjs e guide-render.mjs. Esegui npm test per vedere la copertura esistente, quindi aggiungi asserzioni per i casi elencati di rifiuto, risoluzione delle parità, rendering e conversione del testo. Il lavoro è completato quando queste asserzioni passano e tutelano ogni criterio di accettazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

good first issue priority: low tests

Summary

V8 block coverage shows a handful of reject and tie-break branches in otherwise well-tested modules never run, and the guide page renderer has no unit test at all.

Where

  • site/lib/search.mjs:100-101, :169-178
  • site/lib/safe-fetch.mjs:66-67, :99-101
  • site/lib/schema-check.mjs:30, :34, :47-49
  • site/lib/guide-page.mjs:10-57
  • site/lib/guide-render.mjs:209 (plainText)

Details

The behaviour was checked by hand and is correct today; only the regression guards are missing.

Impact

A future edit could silently break these branches.

Suggested fix

Add the assertions below to site/lib/lib.test.mjs.

Acceptance criteria

  • passesFilters rejects a perspective mismatch and a licence-family mismatch
  • SORTS.license and SORTS.verified break ties by name
  • isPrivateAddress: 198.18.0.1, 198.19.255.255, 198.51.100.7, ::ffff:198.18.0.1 true; 198.20.0.1 false
  • refusalFor("not a url") returns "not a valid URL"
  • schemaErrors with $ref: "http://x" or a missing #/defs/y throws naming the ref
  • Guide page: <&"> in the title is escaped in <title>, breadcrumb and h1; modified: null omits dateModified; long first paragraph clipped to 160 chars in the description; no titleId gives an h1 with no id; edit link is ${repo}/blob/main/${path}
  • plainText strips tags and decodes entities

Getting started

  • Relevant files: site/lib/lib.test.mjs
  • Run the tests: npm test; the full local gate is npm run check (Node 22+, no install step)
  • Related docs: CONTRIBUTING.md, site/README.md

Filed by repo-audit/full-audit at 4adb944. Severity: low. Effort: S. audit-key: testing|site/lib/search.mjs|reject-branches

Lingua principale
JavaScript
Stelle
58
Fork
15
Merge medio
1g 15h
PR unite (30g)
12

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/Free-Game-Dev-Assets

Tutte le issue di TMHSDigital/Free-Game-Dev-Assets

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.