Files
faceclaw/tests
James BabcockandClaude Opus 5.5 1812818ae2 Stop leaking the remaining JS ArrayBuffers passed to Java
The same NativeScript conversion leak as the frame path (see
java-direct-buffer.ts) applied to every other ArrayBuffer handed to a
Java ByteBuffer parameter:

- Shell scenes (submitShellScene on the bridge and the preview display),
  submitted on every shell render, which the frame-path fix predates.
  These now go through a reused JavaDirectBuffer like frames do.
- Glyph, firmware-glyph and image atlas registration, Mapbox image
  decode, the preview placeholder bitmap, firmware hash/write, binary
  file writes and the EvenHub privacy-policy download, plus the Kotlin
  protocol smoke test. These are rare or large, so they cross through a
  new copyToJavaByteBuffer: a fresh Java direct buffer per call that is
  freed normally, rather than one pinned for the life of the isolate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 22:28:45 -07:00
..
2026-09-22 00:25:40 -07:00
2026-09-25 22:13:02 -07:00
2026-09-19 20:52:36 -07:00
2026-09-18 23:30:07 -07:00
2026-09-19 01:37:36 -07:00
2026-09-04 02:23:58 -07:00

Tests

Faceclaw's pairing logic (app/g2/glasses-hardware-identity.ts, ble-proximity.ts, even-advertisement.ts, pairing-candidates.ts, glasses-artwork.ts) is written without NativeScript imports so it can run under plain node. The tests here cover hardware-identity decoding, proximity estimation, the advertisement parsers, and left↔right pair grouping.

Run with:

npm test

That compiles the pure modules with the project's TypeScript into .test-build/ (git-ignored) and runs node --test tests/. No extra dependencies are needed — the tests are plain .test.cjs files that use node:test and node:assert.

The shared Kotlin suite runs separately from the Node tests:

npm run test:kotlin
npm run test:kotlin:ios

It includes the migrated compass, R1 battery, gesture and texture Java fixtures, which now call the Kotlin implementation from Android host tests. Common tests also run as native iOS simulator binaries. See the Kotlin README for SDK requirements, source layout and coverage. The compass and battery fixtures retain the golden packets shared with firmware tests.

The native iOS EvenHub probe runs separately on a booted simulator:

node tests/ios-evenhub-native.cjs <simulator-UUID>

It compiles the production WKWebView host into an isolated app and checks local and remote loading, document-start injection, assets, storage and navigation. It then opens Safari to background the probe and verifies that injected timeouts, intervals and animation callbacks still fire, and cancelled timers stay cancelled. A short UIKit background task keeps the test process running without glasses. This covers the ticker's background behavior; sustained execution with BLE and a locked physical phone still requires device testing.