mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 12:07:09 +00:00
test(spec): cover LongPress and Scroll runtime members
This commit is contained in:
1 parent
792010c6d0
commit
b23a8efbdb
2 files changed
+15
No files matched your search
@@ -143,6 +143,8 @@ function installFakeRuntime(): RecordedRuntime {
|
|||||||
},
|
},
|
||||||
tap: ({ on }) => ({ kind: "Tap", on }),
|
tap: ({ on }) => ({ kind: "Tap", on }),
|
||||||
doubleTap: ({ on }) => ({ kind: "DoubleTap", on }),
|
doubleTap: ({ on }) => ({ kind: "DoubleTap", on }),
|
||||||
|
longPress: ({ on }) => ({ kind: "LongPress", on }),
|
||||||
|
scroll: ({ direction, in: container }) => ({ kind: "Scroll", direction, in: container }),
|
||||||
inputText: ({ into, text }) => ({ kind: "InputText", into, text }),
|
inputText: ({ into, text }) => ({ kind: "InputText", into, text }),
|
||||||
swipe: ({ from: fromPoint, to, durationMillis }) => ({
|
swipe: ({ from: fromPoint, to, durationMillis }) => ({
|
||||||
kind: "Swipe",
|
kind: "Swipe",
|
||||||
@@ -154,6 +156,8 @@ function installFakeRuntime(): RecordedRuntime {
|
|||||||
wait: ({ durationMillis }) => ({ kind: "Wait", durationMillis }),
|
wait: ({ durationMillis }) => ({ kind: "Wait", durationMillis }),
|
||||||
taps: { __sanderlingActionGenerator: true, generate: () => [] },
|
taps: { __sanderlingActionGenerator: true, generate: () => [] },
|
||||||
doubleTaps: { __sanderlingActionGenerator: true, generate: () => [] },
|
doubleTaps: { __sanderlingActionGenerator: true, generate: () => [] },
|
||||||
|
longPresses: { __sanderlingActionGenerator: true, generate: () => [] },
|
||||||
|
scrolls: { __sanderlingActionGenerator: true, generate: () => [] },
|
||||||
typing: { __sanderlingActionGenerator: true, generate: () => [] },
|
typing: { __sanderlingActionGenerator: true, generate: () => [] },
|
||||||
swipes: { __sanderlingActionGenerator: true, generate: () => [] },
|
swipes: { __sanderlingActionGenerator: true, generate: () => [] },
|
||||||
waitOnce: { __sanderlingActionGenerator: true, generate: () => [] },
|
waitOnce: { __sanderlingActionGenerator: true, generate: () => [] },
|
||||||
|
|||||||
@@ -59,12 +59,16 @@ function installRuntime(initialState: State): RecordedRuntime {
|
|||||||
from: <T>(_items: readonly T[]): Sampler<T> => ({ generate: () => _items[0] as T }),
|
from: <T>(_items: readonly T[]): Sampler<T> => ({ generate: () => _items[0] as T }),
|
||||||
tap: ({ on }) => ({ kind: "Tap", on }),
|
tap: ({ on }) => ({ kind: "Tap", on }),
|
||||||
doubleTap: ({ on }) => ({ kind: "DoubleTap", on }),
|
doubleTap: ({ on }) => ({ kind: "DoubleTap", on }),
|
||||||
|
longPress: ({ on }) => ({ kind: "LongPress", on }),
|
||||||
|
scroll: ({ direction, in: container }) => ({ kind: "Scroll", direction, in: container }),
|
||||||
inputText: ({ into, text }) => ({ kind: "InputText", into, text }),
|
inputText: ({ into, text }) => ({ kind: "InputText", into, text }),
|
||||||
swipe: (p) => ({ kind: "Swipe", from: p.from, to: p.to, durationMillis: p.durationMillis }),
|
swipe: (p) => ({ kind: "Swipe", from: p.from, to: p.to, durationMillis: p.durationMillis }),
|
||||||
pressKey: ({ key }) => ({ kind: "PressKey", key }),
|
pressKey: ({ key }) => ({ kind: "PressKey", key }),
|
||||||
wait: ({ durationMillis }) => ({ kind: "Wait", durationMillis }),
|
wait: ({ durationMillis }) => ({ kind: "Wait", durationMillis }),
|
||||||
taps: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
taps: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
||||||
doubleTaps: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
doubleTaps: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
||||||
|
longPresses: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
||||||
|
scrolls: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
||||||
typing: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
typing: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
||||||
swipes: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
swipes: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
||||||
waitOnce: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
waitOnce: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
|
||||||
@@ -125,6 +129,13 @@ test("typing resolves as a valid ActionGenerator", async () => {
|
|||||||
assert.equal(typing.__sanderlingActionGenerator, true);
|
assert.equal(typing.__sanderlingActionGenerator, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("longPresses and scrolls resolve as valid ActionGenerators", async () => {
|
||||||
|
installRuntime(emptyState);
|
||||||
|
const { longPresses, scrolls } = await import("../src/defaults/actions.ts");
|
||||||
|
assert.equal(longPresses.__sanderlingActionGenerator, true);
|
||||||
|
assert.equal(scrolls.__sanderlingActionGenerator, true);
|
||||||
|
});
|
||||||
|
|
||||||
test("defaults barrel re-exports both properties and actions", async () => {
|
test("defaults barrel re-exports both properties and actions", async () => {
|
||||||
installRuntime(emptyState);
|
installRuntime(emptyState);
|
||||||
const barrel = await import("../src/defaults/index.ts");
|
const barrel = await import("../src/defaults/index.ts");
|
||||||
|
|||||||
Reference in new issue
Block a user