FakeNativeWorkouts — @gj-kit/expo-workouts
@gj-kit/expo-workouts/testing에서 공개하는 interface입니다. package version 0.1.1의 release declaration을 그대로 표시합니다.
검증된 import 예제
섹션 제목: “검증된 import 예제”import { FakeNativeWorkouts } from '@gj-kit/expo-workouts/testing';시그니처, 매개변수, 반환 타입
섹션 제목: “시그니처, 매개변수, 반환 타입”/** An in-memory `NativeWorkoutsModule`. THIS is what tests drive; the real JS layer runs on top. */interface FakeNativeWorkouts extends NativeWorkoutsModule { setAvailability(availability: Availability): void; setAuthorization(state: AuthorizationState): void; /** Grant scopes directly — the shape the fake actually stores. */ authorize(grants: FakeScopeGrants): void; /** What this build DECLARED. Requesting outside it is `invalidArgument` naming the missing prop. */ setDeclared(declared: FakeScopeGrants): void; /** How the NEXT `requestPermissions` ends. `'inconclusive'` is f120's onboarding "Go back". */ setNextPermissionOutcome(outcome: FakePermissionOutcome): void; /** Returns the native id. */ addWorkout(workout: FakeWorkoutInput): string; /** Platform-faithful replacement: iOS mints a NEW native id and emits `removed{replaced:true}` * in the same drain batch; Android keeps the SAME id and emits only an upsertion change. */ replaceWorkout(nativeId: string, patch: Partial<FakeWorkoutInput>): string; removeWorkout(nativeId: string): void; /** HealthKit purging a deletion record before we drain it — the workout vanishes with no `removed`. */ purgeDeletion(nativeId: string): void; /** Android: emit an upsertion change carrying an UNCHANGED record — the undetectable stale-version no-op. */ emitNoOpUpsertion(nativeId: string): void; /** Force `reset: true` with a chosen reason on the next sync — reaches all six `CursorResetReason`s. */ expireCursor(reason?: CursorResetReason | undefined): void; setRouteAccess(access: RouteAccess): void; /** Process importance — the only way to reach the background-route path without a device. */ setForeground(foreground: boolean): void; /** Health Connect first-run onboarding: foreign routes read `consentRequired` while this is false * even with the permission held and the app in the foreground. */ setOnboarded(onboarded: boolean): void; /** iOS: protected data unavailable — the `storeLocked` pre-check path. */ setStoreLocked(locked: boolean): void; /** iOS: make the next save return (nil workout, nil error) — the case Phase 0 could not reproduce. */ nextSaveIsPendingUnlock(): void; /** f102: every read primitive raises Health Connect's overloaded `errorCode 7` while this is on. */ setRateLimited(rateLimited: boolean): void; /** f109: `readMetricRecords` returns NOTHING, so every total stays `undefined` — never `0`. */ setMetricsMissing(missing: boolean): void; /** Make the next call to one seam primitive throw a platform-shaped payload, so the error MAPPING * (not just the mapped result) is what the test exercises. */ failNext(primitive: keyof NativeWorkoutsModule, payload: NativePayloadDto): void; /** * f104: make the next call to one seam primitive **never settle**. The Intent-overflow failure is * not an error — the ActivityResult callback simply never fires — so the only faithful fake is a * promise that hangs and lets the caller's timeout be the thing under test. */ hangNext(primitive: keyof NativeWorkoutsModule): void; /** Unreleased route handles. A test asserts this is 0 after every `for await`. */ readonly openRouteHandles: number; readonly calls: readonly { readonly fn: keyof NativeWorkoutsModule; readonly atMs: number; }[];}이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.
Release context
섹션 제목: “Release context”- 패키지:
@gj-kit/expo-workouts - 버전:
0.1.1 - 공개 entry:
./testing - 소스: GitHub
구현 주석
섹션 제목: “구현 주석”An in-memory NativeWorkoutsModule. THIS is what tests drive; the real JS layer runs on top.