From 074eadc7c15f74c7047f9bfa38dca4cd35b1e66d Mon Sep 17 00:00:00 2001 From: v1tharr <73645120+v1tharr@users.noreply.github.com.> Date: Fri, 10 Jul 2026 09:57:19 +0700 Subject: [PATCH] docs: add testing section --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++-- README.ru.md | 21 ++++++++++++++++++++- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bad4f59..8a060d6 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,51 @@ Cloud sync, authentication, custom themes, export, mobile version — planned fo ## Running locally ### Backend - ```bash cd backend pip install -r requirements.txt -python run.py \ No newline at end of file +python run.py +``` +Server runs on `http://localhost:5000` + +### Test data (optional) +```bash +python seed.py +``` + +Database is stored in the system app data folder, not in the project folder: + +| OS | Path | +|---|---| +| Windows | `%LOCALAPPDATA%\folio.ink\` | +| macOS | `~/Library/Application Support/folio.ink/` | +| Linux | `~/.local/share/folio.ink/` | + +### Frontend +```bash +npm install +npm run dev +``` + +## Testing + +### Backend + +Tests use `pytest` with an in-memory SQLite database, so they don't touch your local `folioink.db` file. + +```bash +cd backend +venv\Scripts\activate # Windows +source venv/bin/activate # macOS/Linux +pytest +``` + +Currently covers the `/api/projects` routes (GET/POST) — 10 tests. As new routes (e.g. `/api/entries`) are added, tests should be added under `backend/test/`. + +### Frontend + +Not set up yet — planned: Vitest + React Testing Library for component tests, Playwright for E2E once more screens exist. + +## License + +Apache License 2.0 — see [LICENSE](LICENSE). \ No newline at end of file diff --git a/README.ru.md b/README.ru.md index 17923a7..b874855 100644 --- a/README.ru.md +++ b/README.ru.md @@ -39,7 +39,7 @@ python run.py Сервер поднимается на `http://localhost:5000` -### Тестовые данные (опционально) +### Тестовые данные ```bash python seed.py @@ -53,6 +53,25 @@ python seed.py | macOS | `~/Library/Application Support/folio.ink/` | | Linux | `~/.local/share/folio.ink/` | +## Тестирование + +### Backend + +Тесты используют `pytest` с in-memory SQLite базой, поэтому они не трогают локальный файл `folioink.db`. + +```bash +cd backend +venv\Scripts\activate # Windows +source venv/bin/activate # macOS/Linux +pytest +``` + +Сейчас покрывает роуты `/api/projects` (GET/POST) — 10 тестов. При добавлении новых роутов (например `/api/entries`) тесты нужно добавлять в `backend/test/`. + +### Frontend + +Пока не настроено — планируется: Vitest + React Testing Library для компонентных тестов, Playwright для E2E когда появится больше экранов. + ### Frontend ```bash