mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
cf12be74f5
This commit sets up a minimal, KISS-principle testing infrastructure for both backend and frontend, and includes the fix for Issue #227. Backend Changes: - Add Makefile with test commands (test, test-backend, test-frontend, test-coverage) - Add example test: config/database_test.go - Fix Go 1.25 printf format string warnings in trader/auto_trader.go (Changed log.Printf to log.Print for non-format strings) - All backend tests pass ✓ Frontend Changes: - Add Vitest configuration: web/vitest.config.ts (minimal setup) - Add test utilities: web/src/test/test-utils.tsx - Add example test: web/src/App.test.tsx - Add dependencies: vitest, jsdom, @testing-library/react - All frontend tests pass ✓ Issue #227 Fix: - Fix AITradersPage to allow editing traders with disabled models/exchanges - Change validation to use allModels/allExchanges instead of enabledModels/enabledExchanges - Add comprehensive tests in web/src/components/AITradersPage.test.tsx - Fixes: https://github.com/tinkle-community/nofx/issues/227 CI/CD: - Add GitHub Actions workflow: .github/workflows/test.yml - Non-blocking tests (continue-on-error: true) - Runs on push/PR to main and dev branches Test Results: - Backend: 1 test passing - Frontend: 5 tests passing (including 4 for Issue #227) Co-Authored-By: tinkle-community <tinklefund@gmail.com>
55 lines
1.1 KiB
YAML
55 lines
1.1 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches: [main, dev]
|
|
pull_request:
|
|
branches: [main, dev]
|
|
|
|
jobs:
|
|
backend-tests:
|
|
name: Backend Tests
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true # Don't block PRs
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23'
|
|
|
|
- name: Download dependencies
|
|
run: go mod download
|
|
|
|
- name: Run tests
|
|
run: go test -v ./...
|
|
|
|
- name: Generate coverage
|
|
run: go test -coverprofile=coverage.out ./...
|
|
continue-on-error: true
|
|
|
|
frontend-tests:
|
|
name: Frontend Tests
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true # Don't block PRs
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: web/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: cd web && npm ci
|
|
|
|
- name: Run tests
|
|
run: cd web && npm run test
|