Conformance suite
Proves that an SDK speaks the protocol correctly, over the wire only, so it works for any SDK: JS, Kotlin, Swift, BrightScript. The suite plays the host, launches the app with fresh payloads and checks handshake, JSON-RPC handling, every announced domain, notifications and rejection behavior. Checks of domains the SDK does not announce are skipped, not failed.
From code
import { formatConformanceReport, runConformance } from '@toets/protocol/conformance';
const report = await runConformance({
name: 'my-sdk on Android TV',
fixture: true,
launch: ({ encoded }) =>
exec(`adb shell am start -S -n com.example/.Main --es __toets ${encoded}`),
terminate: () => exec('adb shell am force-stop com.example'),
});
console.log(formatConformanceReport(report));launch must start a fresh app instance each time (the suite launches several: main session, launch state, rejections); terminate stops it.
From the command line
toets-conformance --fixture --launch "node my-app.js --payload {payload}"The payload is substituted for {payload} (base64url) and set as TOETS_PAYLOAD. Without --terminate the launch process is killed. --only <id-prefix> narrows the run (e.g. --only fixture.). Exit code 1 when a check fails, 2 on usage errors.
The fixture
With fixture: true (--fixture) the suite also checks behavior. The app must render CONFORMANCE_FIXTURE:
conformance-aandconformance-b: focusable, visible.conformance-text: not focusable, own textConformance.- Protocol 1.1 SDKs:
conformance-field, a text field holdingTyped, andconformance-secret, a password field holdingpass(reported masked as••••). - An
onStatehandler forconformance:focus-a/conformance:focus-b(move focus there),conformance:log(logflags.markerat info level through the normal console),conformance:busy(markBusyforflags.msms),conformance:fail(throw).
Reference fixtures: packages/sdk/test/fixtures/conformance-app.ts (web) and packages/sdk-react-native/test/conformance.test.ts (React Native).