Repository navigation
node:test suite for app.js, make probe and CSP hashes, palette tool plates out of the shell, drink links from menu rows, Recipe dates and sitemap lastmod - #121
Merged
Conversation
…lates out of the shell, drink links from menu rows, Recipe dates and sitemap lastmod scripts/app.test.mjs runs assets/app.js in node under node:test: the IIFE is taken off, a stub page stands in for the DOM, and boot runs on the real data. 19 cases cover build amounts and serve tokens, the key tab against the decoder, shelf code round trips and bad codes, stand-ins, garnish gating, Next bottles, QR version capacity and format bits, malformed stores, and the row link click. scripts/unit-report.mjs prints the house summary line. make unit is part of make check. scripts/probe.py (make probe) reads the live origin without following redirects: http to https on the same path, HSTS, nosniff, Referrer-Policy, Permissions-Policy, and a CSP whose script-src names the hash of every inline script in the tree. It is not part of make verify. stage.py prints those sha256 hashes after a stage. make-tools.py writes each plate as a palette PNG of the one ink at eight evenly spaced alphas with tRNS: 938 KB to 188 KB. The plates are out of the worker SHELL and go network-first. check_assets.py requires colour type 3 with tRNS and refuses a plate in the shell. Menu rows are a div holding an overlay expand button and the text, with the name as a link to /drink/<id>/. A plain click on the name expands the row and moves focus to the button; a modifier click is left to the browser. The text is the button name through aria-labelledby and is aria-hidden, and the link has tabindex -1. pages.py adds datePublished, dateModified and totalTime to the Recipe JSON-LD, and lastmod to the sitemap in place of changefreq and priority. Dates come from the generated data/dates.json, keyed on a hash of each drink and seeded from git history; make pages dates an edit to the day it runs and --check refuses a stale entry. Closes #114. Closes #111. Closes #112. Refs #101.
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.
app.js tests (#114)
scripts/app.test.mjsrunsassets/app.jsin node undernode:test, with no dependency and nopackage.json. The IIFE is taken off, a stub page stands in for the DOM, and boot runs on the real data, soapp.jsneeds no test hook.make unitis part ofmake check.app.js, swappingqandQamong them; each one fails a case.scripts/unit-report.mjsprints the one-line summary, or each failure in full, including what the file wrote to stderr when boot itself fails.retired_bitsis empty, so the retired-bit case covers nothing yet.make probe and CSP hashes (#101, repo part)
scripts/probe.py: read-only, follows no redirect. It checks http to https on the same path, HSTS, nosniff, Referrer-Policy, Permissions-Policy, and a CSP (enforced or report-only) whose script-src names every inline script hash from the tree. Not part ofmake verify./and/drink/martini/(10 checks).stage.pyprints the sha256 hashes after a stage. There are two, not three: the drink pages' GTM snippet is byte-identical to the one inindex.html.Tool plates (#111)
make-tools.pywrites each plate as a palette PNG of the one ink at eight evenly spaced alphas with tRNS: 938 KB to 188 KB (du212K). Compared at the Info tab's display size, dark and light: worst pixel difference 9/255. Twelve or more levels go past 250 KB, and Pillow's 64-colour octree produced eight uneven levels anyway.SHELLand go network-first like the glasses.check_assets.pyrequires colour type 3 with tRNS and refuses a plate in the shell.Drink links, Recipe dates, lastmod (#112)
divwith the expand button laid over the row, and the name is a link to/drink/<id>/above it; the front page renders 185 of these links.aria-labelledbyand isaria-hidden, and the link hastabindex="-1", so a screen reader and a keyboard still get one control per row.datePublished,dateModifiedandtotalTime(PT3M stirred and shaken, PT2M built). The sitemap carrieslastmodand dropschangefreqandpriority.data/dates.json, keyed on a hash of each drink and seeded once from git history.make pagesdates an edit to the day it runs and--checkrefuses a stale entry, so CI never asks git.Tested
make verifypasses: 292 checker cases, 19 unit cases.Not verified
make uniton the CI runner, which needs Node 20 or newer.Closes #114. Closes #111. Closes #112. Refs #101.