name: mobile-tests
skill: mobile
version: 1.0.0
cases:
  - id: permissions-on-launch
    description: Should reject requesting permissions on launch and recommend requesting at moment of need
    prompt: Should I request camera, location, and notification permissions when the app first launches?
    expected:
      contains_any:
        - moment of need
        - context
        - denied
        - launch
        - explain
        - when the user
      not_contains:
        - "on launch is fine"
        - "all at once"
      min_length: 60
    tags: [core, permissions]

  - id: offline-blank-screen
    description: Should recommend caching and showing cached data instead of blank screen when offline
    prompt: When the user has no internet connection, my app shows a blank screen. What should I do?
    expected:
      contains_any:
        - cache
        - offline
        - cached data
        - AsyncStorage
        - local
        - show
      min_length: 60
    tags: [core, offline]

  - id: flatlist-scrollview-long-list
    description: Should recommend FlatList over ScrollView for long dynamic lists
    prompt: I'm rendering a list of 500 user records using a ScrollView. The app is sluggish. What should I use instead?
    expected:
      contains_any:
        - FlatList
        - virtuali
        - scroll
        - performance
        - lazy
        - render
      min_length: 60
    tags: [core, performance]

  - id: animation-native-driver
    description: Should require useNativeDriver true for animations to avoid JS thread blocking
    prompt: My React Native animations are janky. I'm using Animated.timing but it stutters during heavy list rendering.
    expected:
      contains_any:
        - useNativeDriver
        - native thread
        - JS thread
        - bridge
        - true
      min_length: 60
    tags: [core, performance, animation]

  - id: platform-divergence
    description: Should recommend platform-specific components where iOS and Android conventions differ
    prompt: I want my app's navigation to work well on both iOS and Android. Should I use the same component for both?
    expected:
      contains_any:
        - platform
        - iOS
        - Android
        - conventions
        - Platform.select
        - native
      min_length: 60
    tags: [core, platform]

  - id: real-device-testing
    description: Should require testing on real devices, especially mid-range Android
    prompt: I've tested my app on the iOS simulator and Android emulator and it looks great. Can I ship it?
    expected:
      contains_any:
        - real device
        - mid-range
        - Android
        - simulator
        - emulator
        - performance
      min_length: 60
    tags: [testing, devices]

  - id: coding-easy-offline-cache
    description: "Coding challenge (easy): Write a React Native hook for offline-first data caching"
    prompt: "Write a React Native custom hook called useOfflineData that fetches data from an API and caches it in AsyncStorage. It should: return cached data immediately while fetching fresh data, update the cache when fresh data arrives, show stale data with an indicator when offline, and handle cache invalidation with a configurable TTL."
    expected:
      contains_any:
        - AsyncStorage
        - cache
        - fetch
        - offline
        - stale
        - TTL
      contains:
        - function
      not_contains:
        - "I can't write"
      min_length: 100
    tags:
      - coding-easy

  - id: coding-medium-permission-flow
    description: "Coding challenge (medium): Implement a permission request flow with rationale"
    prompt: "Write a React Native hook called usePermission that handles the full permission lifecycle. It should: check current permission status, show a custom rationale dialog before the system prompt (explaining why the permission is needed), request the permission, handle all states (granted/denied/blocked/unavailable), deep-link to app settings when permanently denied, and track permission state changes across app foreground/background transitions."
    expected:
      contains_any:
        - permission
        - request
        - rationale
        - settings
        - Linking
        - AppState
        - denied
      contains:
        - function
      min_length: 200
    tags:
      - coding-medium

  - id: coding-hard-sync-engine
    description: "Coding challenge (hard): Build an offline-first sync engine for mobile"
    prompt: "Write a React Native sync engine class that handles offline-first data synchronization. It should: queue mutations in a local SQLite database when offline, replay queued mutations when connectivity is restored (in order), handle conflict resolution (server wins by default, with custom resolver option), support partial sync (only changed records since last sync timestamp), retry failed syncs with exponential backoff, and emit events for sync status changes."
    expected:
      contains_any:
        - queue
        - SQLite
        - sync
        - conflict
        - offline
        - retry
        - timestamp
      contains:
        - class
      min_length: 300
    tags:
      - coding-hard
