gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commited4cbab2ed4cbab2status timemreed4cbab2/tests/person-lookup.mjs

1.7 KB

  1. // tracker#46 gate: the person page's per-request code (components/person.hl, people.hl `filmographyOf`, `personInfoOf`) must not
  2. // fetch a title's whole record per credit (showsTable.fetch / showById / liveShowOf: 311 decoded records for Tom Hanks per
  3. // request, which fed the byte-triggered GC) nor scan a table (find / iterate). It reads the slim `creditRowLive` cache.
  4. // usage: node tests/person-lookup.mjs [tree] (default: the tree of this file)
  5. import { readFileSync } from 'node:fs';
  6. import { dirname, resolve } from 'node:path';
  7. import { fileURLToPath } from 'node:url';
  8. const root = resolve(process.argv[2] ?? resolve(dirname(fileURLToPath(import.meta.url)), '..'));
  9. const people = readFileSync(root + '/lib/people.hl', 'utf8');
  10. const comp = readFileSync(root + '/components/person.hl', 'utf8');
  11. const body = (src, name) => {
  12. const i = src.indexOf('static ' + name + ' = ');
  13. if (i < 0) throw new Error('no ' + name);
  14. const m = src.indexOf('\nstatic ', i + 10);
  15. return src.slice(i, m < 0 ? undefined : m);
  16. };
  17. const banned = /showsTable\.(fetch|find|iterate)|showById\(|liveShowOf\(|\.find\(|\.iterate\(/;
  18. let bad = 0;
  19. for (const [label, text] of [['people.hl filmographyOf', body(people, 'filmographyOf')], ['people.hl personInfoOf', body(people, 'personInfoOf')],
  20. ['people.hl personBySlug', body(people, 'personBySlug')], ['components/person.hl', comp.split('\n').filter(l => !l.trim().startsWith('//')).join('\n')]]) {
  21. const m = text.match(banned);
  22. if (m) { bad++; console.log('FAIL ' + label + ': ' + m[0]); } else console.log('ok ' + label);
  23. }
  24. if (!/creditRowLive\(/.test(body(people, 'filmographyOf'))) { bad++; console.log('FAIL filmographyOf does not use creditRowLive'); }
  25. console.log(bad ? 'person-lookup: FAILED' : 'person-lookup: passed');
  26. process.exit(bad ? 1 : 0);

Branches

Latest commits

  • ed4cbab2status timemre
  • e982c26dlog: HM65 mergedmre
  • 6e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre
  • 07a5c883HM65 report measured field projection and complete validationmre
  • 0eab858fRead only catalog date fields during the episode boot scanmre
  • d3179273log: HM65 hl:heap vendoringmre
  • cb78a1a0HM65 report missing heap diagnostic package with repromre
  • 89606a5cHM65 briefmre
  • 096ce0d4log: DP69 live on day48mre
  • b3d8a80bDP69 brief, RV48 mergedmre
  • ce6d7d32Merge rv48: Hybriel day48mre
  • 3da2ea86RV48: report day48 cold starts, gates and cleanupmre
  • 8d9ecdfeRV48: re-vendor Hybriel set day48 (source b6a8f429, bin 660a9524)mre
  • 4a802ae7status: RV48 runningmre
  • 0a5412b6RV48 brief, day48 outmre
  • 56665efelog: CB69 mergedmre
  • 05448a98Merge cb69-imports: appTitle in a dependency-free topicmre
  • e55b379dKeep shared app title independent of the route import graphmre
  • 9a99659blog: hybriel#334, batch waits for day48mre
  • 85fa6c9blog: CB68 result, CB69 startedmre