test: add unit test suites and coverage gates for build-assets.py and brand.js - #7
Open
devin-ai-integration[bot] wants to merge 3 commits into
Open
devin-ai-integration[bot] wants to merge 3 commits into
devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Das Repository hatte keine Tests und kein Test-Tooling — die Coverage der beiden Code-Module lag bei 0%. Dieser PR fügt zwei Suiten plus CI und Coverage-Schwellen hinzu:
scripts/build-assets.pybrand.jsscripts/build-assets.py(tests/test_build_assets.py, pytest): Das Skript lief komplett auf Modulebene, war also nicht importierbar. Die Pipeline ist unverändert in Funktionen extrahiert:Alle Größen, Paddings, Farben, Pfade und die Reihenfolge sind unverändert. Zusätzlich wird
cairosvgerst inrender_svg()importiert, damit die Tests ohne native Cairo-Bibliothek laufen (render_svgwird gemockt bzw.sys.modules["cairosvg"]ersetzt). Getestet werdenfnt,contain,favicon,grid,banner,render_svg, die vollständigen Ausgabesets vonbuild_brand/build_proxmox/mainintmp_pathsowie die Konsistenz derBRANDS-Tabelle mit den SVG-Quellen auf der Platte.brand.js(tests/brand.test.js, vitest + jsdom):brand.jsbleibt unverändert (klassisches<script src>— Exports würden das Portal brechen). Die Tests bauen pro Fall das DOM ausindex.htmlnachgebildet auf, stubbenfetch/navigator.clipboardund importierenbrand.jsanschließend über die vitest-Pipeline, sodass die Coverage tatsächlich von den Tests erzeugt wird. Geprüft wird ausschließlich beobachtbares Verhalten: Rendering und Escaping der Karten/Asset-Zeilen, Fallback-Marks (inkl.img-error), Filterung über Input und Karten-Klicks, Raw- vs. Repo-Links, fehlendecanonicalRawBase, die deutschen Fehlerzustände bei!r.okund geworfenemfetch, Scroll-Progress und Pointer-CSS-Variablen.tests/test_manifest.py: validiertassets/img/manifest.jsongegen die Platte — eindeutige Brand-IDs, Pflichtfelder und jederpathexistiert wirklich.CI/Tooling:
.github/workflows/tests.yml(Python 3.12 + Node 20, jeweils mit Coverage),requirements-dev.txt,package.json/package-lock.json,vitest.config.js,.gitignore, Coverage-Schwellen (--cov-fail-under=90, vitestthresholds90/90/80) und einTests-Abschnitt im README.Gefundener Defekt (nicht behoben)
Der Copy-Handler in
brand.jslieste.currentTargetnach einemawait, wo es sowohl im Browser als auch in jsdomnullist:Der Pfad wird also kopiert, aber das Label wechselt nie auf „Kopiert“. Der Test dokumentiert dieses Ist-Verhalten, statt es zu verstecken. Fix wäre eine Zeile (
const btn=e.currentTarget;vor demawait) — bewusst nicht in diesem Test-PR enthalten.Die Shell-Skripte (
proxmox/install-webowie-proxmox-branding.sh,scripts/create-netbootxyz-alpine-lxc.sh) bleiben ungetestet; das bräuchte ein Bats-Setup.Link to Devin session: https://app.devin.ai/sessions/82fc2e68846a4cb2b36a91a3791731f4
Requested by: @puchadave