banatie-service/tests/api/INSTALLATION.md

138 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 📦 Installation Instructions
## Шаги установки тестовых скриптов
### 1. Создайте структуру директорий
```bash
cd /projects/my-projects/banatie-service
mkdir -p tests/api/fixtures
mkdir -p results
```
### 2. Скопируйте файлы
Скопируйте все файлы из `/tmp/` в соответствующие директории:
```bash
# Core files
cp /tmp/test-config.ts tests/api/config.ts
cp /tmp/test-utils.ts tests/api/utils.ts
cp /tmp/test-run-all.ts tests/api/run-all.ts
cp /tmp/test-README.md tests/api/README.md
# Test files
cp /tmp/test-01-basic.ts tests/api/01-basic.ts
cp /tmp/test-02-flows.ts tests/api/02-flows.ts
cp /tmp/test-03-aliases.ts tests/api/03-aliases.ts
cp /tmp/test-04-live.ts tests/api/04-live.ts
cp /tmp/test-05-edge-cases.ts tests/api/05-edge-cases.ts
# Test fixture
cp /tmp/test-image.png tests/api/fixtures/test-image.png
```
### 3. Обновите package.json
Добавьте скрипты в root `package.json`:
```json
{
"scripts": {
"test:api": "tsx tests/api/run-all.ts",
"test:api:basic": "tsx tests/api/01-basic.ts",
"test:api:flows": "tsx tests/api/02-flows.ts",
"test:api:aliases": "tsx tests/api/03-aliases.ts",
"test:api:live": "tsx tests/api/04-live.ts",
"test:api:edge": "tsx tests/api/05-edge-cases.ts"
}
}
```
Установите зависимости (если еще нет):
```bash
pnpm add -D tsx @types/node
```
### 4. Настройте environment
Создайте `.env` в корне проекта (если еще нет):
```bash
API_KEY=bnt_your_test_api_key_here
API_BASE_URL=http://localhost:3000
```
### 5. Обновите .gitignore
Добавьте в `.gitignore`:
```
# Test results
results/
# Test environment
tests/api/.env
```
### 6. Проверка установки
```bash
# Проверьте структуру
tree tests/api
# Должно выглядеть так:
# tests/api/
# ├── config.ts
# ├── utils.ts
# ├── fixtures/
# │ └── test-image.png
# ├── 01-basic.ts
# ├── 02-flows.ts
# ├── 03-aliases.ts
# ├── 04-live.ts
# ├── 05-edge-cases.ts
# ├── run-all.ts
# └── README.md
```
### 7. Первый запуск
```bash
# Запустите API сервер
pnpm dev
# В другом терминале запустите тесты
pnpm test:api:basic
```
## ✅ Checklist
- [ ] Директории созданы
- [ ] Все файлы скопированы
- [ ] package.json обновлен
- [ ] .env настроен с API key
- [ ] .gitignore обновлен
- [ ] Зависимости установлены
- [ ] API сервер запущен
- [ ] Первый тест прошел успешно
## 🎯 Готово!
Теперь можно запускать:
```bash
# Все тесты
pnpm test:api
# Отдельные наборы
pnpm test:api:basic
pnpm test:api:flows
pnpm test:api:aliases
pnpm test:api:live
pnpm test:api:edge
```
Результаты будут в `results/` директории.