콘텐츠로 이동

createFakeNativeWorkouts — @gj-kit/expo-workouts

@gj-kit/expo-workouts/testing에서 공개하는 function입니다. package version 0.1.1의 release declaration을 그대로 표시합니다.

import { createFakeNativeWorkouts } from '@gj-kit/expo-workouts/testing';
/**
* An in-memory `NativeWorkoutsModule`.
*
* ⚠ **The fake HONOURS SCOPES**: seed a fully-populated workout, authorize with only `['workouts']`,
* and `listWorkouts` hands back `distanceM: undefined`. The read trap becomes reproducible in
* `pnpm test`, on Node, in the CONSUMER'S OWN suite. The write side is symmetric: saving a workout
* whose `requiredWriteScopes()` are not all granted rejects with `notAuthorized` naming the missing
* scope, exactly as Android would.
*
* **States this fake still cannot reach** (they are platform facts with no seam representation):
* - iOS `pendingUnlock` caused by `finishRoute` failing while locked — the seam reports one
* `SaveOutcomeDto`, so the fake can produce `pendingUnlock`, but not the sub-case where the
* workout landed and only the route builder failed (f70 was never reproduced on a device either).
* - Health Connect's 30-day history wall silently TRUNCATING a large read (f46 in §5.7) — the
* platform gives no signal, so nothing downstream can be asserted.
* - `FLAG_PERMISSION_USER_FIXED` ("routes never work again, silently") — Phase 0 never reached it,
* so there is no measured behaviour to imitate.
*/
declare function createFakeNativeWorkouts(seed?: FakeSeed): FakeNativeWorkouts;

이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.

  • 패키지: @gj-kit/expo-workouts
  • 버전: 0.1.1
  • 공개 entry: ./testing
  • 소스: GitHub

An in-memory NativeWorkoutsModule.

The fake HONOURS SCOPES: seed a fully-populated workout, authorize with only ['workouts'], and listWorkouts hands back distanceM: undefined. The read trap becomes reproducible in pnpm test, on Node, in the CONSUMER’S OWN suite. The write side is symmetric: saving a workout whose requiredWriteScopes() are not all granted rejects with notAuthorized naming the missing scope, exactly as Android would.

States this fake still cannot reach (they are platform facts with no seam representation):

  • iOS pendingUnlock caused by finishRoute failing while locked — the seam reports one SaveOutcomeDto, so the fake can produce pendingUnlock, but not the sub-case where the workout landed and only the route builder failed (f70 was never reproduced on a device either).
  • Health Connect’s 30-day history wall silently TRUNCATING a large read (f46 in §5.7) — the platform gives no signal, so nothing downstream can be asserted.
  • FLAG_PERMISSION_USER_FIXED (“routes never work again, silently”) — Phase 0 never reached it, so there is no measured behaviour to imitate.