Add Android unit and UI tests with test dependencies
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Loam — MTB Build & Tune
|
||||
|
||||
A Next.js web app for mountain bike riders to configure builds, get manufacturer-verified suspension and tire setup starting points, save post-ride reviews, and receive AI-powered tuning recommendations based on personal preference history.
|
||||
A Next.js web app and native Android client for mountain bike riders to configure builds, get manufacturer-verified suspension and tire setup starting points, save post-ride reviews, and receive AI-powered tuning recommendations based on personal preference history.
|
||||
|
||||
Built with Next.js App Router, Prisma/PostgreSQL, and Ollama for local LLM inference. The API layer is designed for reuse in a future React Native/Android client.
|
||||
The backend is built with Next.js App Router, Prisma/PostgreSQL, and Ollama for local LLM inference. The Android client is built with Kotlin, Jetpack Compose, Ktor, and Koin against the same JSON API.
|
||||
|
||||
---
|
||||
|
||||
@@ -18,6 +18,7 @@ Built with Next.js App Router, Prisma/PostgreSQL, and Ollama for local LLM infer
|
||||
| Images | sharp (layer compositing) |
|
||||
| AI | Ollama (local LLM) |
|
||||
| Validation | Zod |
|
||||
| Android | Kotlin, Jetpack Compose, Ktor, Koin |
|
||||
|
||||
---
|
||||
|
||||
@@ -116,6 +117,12 @@ src/
|
||||
types.ts # shared TypeScript types
|
||||
public/
|
||||
images/ # product assets + user-generated builds
|
||||
android/
|
||||
app/src/main/java/com/bikeloam/app/
|
||||
data/ # DTOs, Ktor API client, repository
|
||||
navigation/ # Compose navigation graph
|
||||
ui/ # Compose screens, theme, ViewModels
|
||||
app/src/test/ # JVM unit tests for repository + ViewModels
|
||||
```
|
||||
|
||||
---
|
||||
@@ -169,15 +176,23 @@ The `/api/setup-audit` endpoint returns a full breakdown of confidence levels an
|
||||
|
||||
---
|
||||
|
||||
## Notes on Android reuse
|
||||
## Android client
|
||||
|
||||
The API surface is plain JSON over HTTP with cookie-based auth. A React Native or Android client can reuse the same endpoints by:
|
||||
The native Android app lives in [`android/`](android/README.md). It uses the same plain JSON API over HTTP with cookie-based auth:
|
||||
|
||||
1. Implementing cookie jar storage for the `loam-session` cookie
|
||||
2. Calling `/api/auth/login` or `/api/auth/register` to obtain a session
|
||||
3. Reusing `/api/builds`, `/api/reviews`, `/api/ai/recommend`, and `/api/catalog` as-is
|
||||
|
||||
The image composition endpoint (`/api/images/compose`) returns a PNG path; clients can either request server-side composition or replicate the layer-stacking logic locally.
|
||||
For local emulator development, the debug build points at `http://10.0.2.2:3000`. Start the web backend with `npm run dev`, then build or test the app from the Android project:
|
||||
|
||||
```bash
|
||||
cd android
|
||||
./gradlew assembleDebug
|
||||
./gradlew testDebugUnitTest
|
||||
```
|
||||
|
||||
The image composition endpoint (`/api/images/compose`) returns a PNG path; mobile clients can either request server-side composition or replicate the layer-stacking logic locally.
|
||||
|
||||
---
|
||||
|
||||
@@ -192,6 +207,15 @@ The image composition endpoint (`/api/images/compose`) returns a PNG path; clien
|
||||
| `npm run db:studio` | Open Prisma Studio |
|
||||
| `npm run lint` | Run ESLint |
|
||||
|
||||
Android commands are run from `android/`:
|
||||
|
||||
| Command | Purpose |
|
||||
|---|---|
|
||||
| `./gradlew assembleDebug` | Build the debug APK |
|
||||
| `./gradlew installDebug` | Install debug build on a connected device or emulator |
|
||||
| `./gradlew testDebugUnitTest` | Run JVM unit tests |
|
||||
| `./gradlew connectedDebugAndroidTest` | Run instrumented Android tests |
|
||||
|
||||
---
|
||||
|
||||
## Environment variables
|
||||
|
||||
Reference in New Issue
Block a user