gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitd18851fdd18851fdjb19: pressed switches look different (whole selector), queue column cannot widen past the panel, gates follow the new bar (jb3, jb11, jb15)mred18851fd/plugins/time/tests/parity.mjs

1.9 KB

  1. // plugins/time/tests/parity.mjs — client.js (the browser half) against the native plugin.
  2. // node plugins/time/tests/parity.mjs
  3. // Runs parity.hl natively and the same calls through client.js in Node (Intl), and compares line
  4. // for line: the DST gap and fold of Europe/Vienna and America/New_York in 2026, and 1970.
  5. import { spawnSync } from 'node:child_process';
  6. import { readFileSync } from 'node:fs';
  7. import { dirname, join, resolve } from 'node:path';
  8. import { fileURLToPath } from 'node:url';
  9. const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../../..');
  10. const BIN = process.env.HL_BIN || join(ROOT, 'native/zig-out/bin/hybriel');
  11. let failed = false;
  12. const ok = (c, m) => { if (!c) { failed = true; console.log('FAIL ' + m); } else console.log('ok ' + m); };
  13. ok(readFileSync(join(ROOT, 'plugins/time/client.js'), 'utf8') === readFileSync(join(ROOT, 'plugins/time/server.js'), 'utf8'), 'client.js is server.js, byte for byte (one implementation, two names)');
  14. const t = await import(join(ROOT, 'plugins/time/client.js'));
  15. const cases = [
  16. ['Europe/Vienna', 2026, 3, 29, 2, 30], ['Europe/Vienna', 2026, 10, 25, 2, 30],
  17. ['America/New_York', 2026, 3, 8, 2, 30], ['America/New_York', 2026, 11, 1, 1, 30],
  18. ['Europe/Vienna', 1970, 1, 1, 0, 0], ['America/New_York', 1970, 6, 1, 12, 0], ['Europe/Vienna', 2026, 7, 1, 12, 0],
  19. ];
  20. const mine = cases.map(([z, y, m, d, h, mi]) => {
  21. const ms = t.fromLocal({ year: y, month: m, day: d, hour: h, minute: mi }, z);
  22. return `${z} ${ms} ${t.offset(ms, z)} ${t.localTimestamp(ms, z)} ${t.timestamp(ms)} ${JSON.stringify(t.local(ms, z))} ${t.isZone(z)}`;
  23. });
  24. const r = spawnSync(BIN, [join(ROOT, 'plugins/time/tests/parity.hl')], { encoding: 'utf8' });
  25. const native = r.stdout.trim().split('\n');
  26. ok(r.status === 0 && native.length === mine.length, 'native run answered ' + mine.length + ' lines');
  27. mine.forEach((l, i) => ok(l === native[i], l.slice(0, 60) + (l === native[i] ? '' : '\n native: ' + native[i] + '\n client: ' + l)));
  28. process.exit(failed ? 1 : 0);

Branches

Latest commits

  • d18851fdjb19: pressed switches look different (whole selector), queue column cannot widen past the panel, gates follow the new bar (jb3, jb11, jb15)mre
  • 82b54c0ejb19: bar Shuffle · Previous · Play · Next · Repeat, no 10 s buttons; Shuffle switch (shuffle from the playing song, back to the list), Repeat off/all/one, both remembered in ui.json; Shuffle my favourites an ordinary button; gate tests/jb19.mjsmre
  • ba354710jb19: icons pinned to components.hybriel 46fefaa (shuffle, repeat, repeatOne, prevTrack, nextTrack)mre
  • d8e8d059jb19 step 2: media-player from components.hybriel c96709c (skip, repeat options; the end of a song only calls onPlay), sync-components.sh and SOURCE point to it, jb11 counts media loads and metadata writes (from jb21 d3a026e)mre
  • 7b048c1bRecords: jb19 done, L2 live stepmre
  • 665185aeMission 009: jb19 livemre
  • 47b2d3beRecords: P1 resumedmre
  • 8e326e94Records: resetKey blockedmre
  • f72dd7edRecords: icons comingmre
  • b264e5deRecords: P1 icons stopmre
  • 514d7cbeRecords: mission 008 startedmre
  • 61c40127Mission 008: #19 + #21mre
  • 6dcaeb46Records: resetKey planmre
  • c5dbf2ecRecords: R2 resultmre
  • 956069b8Records: R1 result, mission 007mre
  • 3c8a2e12Mission 007: #20 sort scrollmre
  • deb8cef5Records: mission 006 startedmre
  • 4f0ad42fMission 006: jukebox#20mre
  • 800cae06Records: #21 planmre
  • 64bc7823Records: #21 causemre