test(devices): Phase 2 — ESC/POS byte stream + printer routing

Pins the device-layer bugs we kept hand-verifying, as pure byte-stream assertions
(no sockets, no hardware):

- printer-escpos.test.ts (12): CP852 codepage select; the ë→0x89 / Ë→0xD3 mapping
  and the em-dash/⚠ ASCII fallbacks (never a stray 0x3f "?"); and the Code128 MODULE
  WIDTH contract — a short ticket id at width 3, but the ~20-char out-of-window
  occurrence id at width 2 so it fits the 80mm head (width 3 overflows ~576 dots and
  the firmware silently aborts the barcode). Plus the QR-and-Code128 dual encoding and
  the Albanian stamp() format.
- printer-routing.test.ts (6): the failover order (booth printer is a fallback for
  entry tickets; a receipt never prints on the outside dispenser), rank-then-id
  tiebreak, and printWithFailover walking the order + NoPrinterAvailableError.

Wires Vitest into @parking/devices. devices 18/18 green.

Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
This commit is contained in:
2026-06-21 16:17:51 +02:00
parent 5e9be16f65
commit 352c643009
6 changed files with 212 additions and 3 deletions
+4 -2
View File
@@ -15,13 +15,15 @@
"build": "tsc -b",
"dev": "tsc -b --watch",
"typecheck": "tsc --noEmit",
"lint": "tsc --noEmit"
"lint": "tsc --noEmit",
"test": "vitest run"
},
"dependencies": {
"@parking/shared": "workspace:*"
},
"devDependencies": {
"@types/node": "25.9.3",
"typescript": "6.0.3"
"typescript": "6.0.3",
"vitest": "^4.1.9"
}
}