mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
test(doubleTap): cover constructor, verifier round-trip, and runner dispatch
This commit is contained in:
1 parent
fb085eeaa0
commit
87834caf96
4 files changed
+71
No files matched your search
@@ -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 = {
|
||||
|
||||
@@ -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 }),
|
||||
|
||||
Reference in new issue
Block a user