--- name: test-changes description: Run tests for recent changes before committing --- Run pytest for backend changes and check frontend builds successfully. Always run before claiming work is complete. ## Backend Tests 1. Navigate to repo root: ``` cd C:\Users\270015376\Documents\github\flask-shopdb ``` 2. Run full test suite: ``` pytest -v ``` 3. If focusing on specific plugin: ``` pytest tests/test_plugins/test_endpoints*.py -v pytest tests/test_plugins/test_notifications*.py -v ``` 4. For migration tests: ``` pytest tests/test_plugin_migrations.py -v ``` ## Frontend Checks 1. Navigate to frontend: ``` cd C:\Users\270015376\Documents\github\flask-shopdb\frontend ``` 2. Run frontend build to catch errors: ``` npm run build ``` This will catch Vue template errors, TypeScript issues, etc. 3. If tests exist: ``` npm test ``` ## Pre-Commit Checks Run the naming/style checker: ``` ./scripts/check-naming-and-style.sh ``` This verifies: - Database table names are lowercase concatenated - No unicode/emojis in code - Column names are snake_case ## What to Check Based on Changes **Database migrations**: - Run `pytest tests/test_plugin_migrations.py -v` - Verify migration runs forward and backward - Check no JSONB (use TEXT for MySQL) **API endpoints**: - Run tests for the specific plugin - Test authentication/authorization - Check XSS escaping if handling user input **Frontend components**: - Run `npm run build` to catch template errors - Check browser console for runtime errors - Test in actual browser if UI change **Agent/Tray**: - Build with `dotnet build` to catch compile errors - No automated tests yet, test manually ## Common Test Failures **Migration conflicts**: - Two branches both added migrations - Renumber the newer one **Import errors**: - Missing `from shopdb.api import ...` - Should use API surface, not internal imports **Database name violations**: - Table name has underscores (should be concatenated lowercase) - Column name not snake_case ## Notes - Tests must pass before pushing to origin - Frontend build must complete without errors - Style checker must pass - Manual testing for agent/tray changes