test(doubleTap): cover constructor, verifier round-trip, and runner dispatch

This commit is contained in:
pj committed 2026-05-30 11:05:58 +05:30
1 parent fb085eeaa0
commit 87834caf96
4 files changed
+71

No files matched your search

+8
View File
@@ -2,6 +2,7 @@ import assert from "node:assert/strict";
import { test } from "node:test";
import {
DoubleTap,
InputText,
PressKey,
Swipe,
@@ -138,6 +139,7 @@ function installFakeRuntime(): RecordedRuntime {
return { generate: () => items[0] as T };
},
tap: ({ on }) => ({ kind: "Tap", on }),
doubleTap: ({ on }) => ({ kind: "DoubleTap", on }),
inputText: ({ into, text }) => ({ kind: "InputText", into, text }),
swipe: ({ from: fromPoint, to, durationMillis }) => ({
kind: "Swipe",
@@ -218,6 +220,12 @@ test("Tap returns a TapAction with the supplied selector", () => {
assert.deepEqual(action, { kind: "Tap", on: "id:login_continue" });
});
test("DoubleTap returns a DoubleTapAction with the supplied selector", () => {
installFakeRuntime();
const action = DoubleTap({ on: "id:save" });
assert.deepEqual(action, { kind: "DoubleTap", on: "id:save" });
});
test("Tap accepts an AccessibilityElement", () => {
installFakeRuntime();
const element: AccessibilityElement = {
+1
View File
@@ -58,6 +58,7 @@ function installRuntime(initialState: State): RecordedRuntime {
}),
from: <T>(_items: readonly T[]): Sampler<T> => ({ generate: () => _items[0] as T }),
tap: ({ on }) => ({ kind: "Tap", on }),
doubleTap: ({ on }) => ({ kind: "DoubleTap", on }),
inputText: ({ into, text }) => ({ kind: "InputText", into, text }),
swipe: (p) => ({ kind: "Swipe", from: p.from, to: p.to, durationMillis: p.durationMillis }),
pressKey: ({ key }) => ({ kind: "PressKey", key }),