Neural Sync Active
Learning Objectives
Registry Synced
Learning Objectives
161 words
1 min read
Reading compass
Now · Step 1: Backend Tests
Learning Objectives
- Write unit and integration tests
- Debug API endpoints
- Handle edge cases
Step 1: Backend Tests
python# tests/test_api.py import unittest from app import app, db from models import Post class TestAPI(unittest.TestCase): def setUp(self): app.config['TESTING'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' self.client = app.test_client() def test_create_post(self): response = self.client.post('/api/posts', json={ 'title': 'Test', 'content': 'Test content' }) self.assertEqual(response.status_code, 201) self.assertIn('id', response.get_json()) def test_get_posts(self): response = self.client.get('/api/posts') self.assertEqual(response.status_code, 200)
Step 2: Frontend Tests
jsx// frontend/src/__tests__/App.test.js import { render, screen } from '@testing-library/react'; import App from '../App'; test('renders app title', () => { render(<App />); const title = screen.getByText(/MAD1 Project/i); expect(title).toBeInTheDocument(); });
- 500 errors: Check Flask debug output
- 404 errors: Verify route registration
- CORS: Check flask-cors configuration
- Database: Run migrations
- Backend unit tests pass
- Frontend tests pass
- Edge cases handled
- Error responses with proper status codes Join Discord PreviousMilestone 5: Advanced Features & DeploymentNextMilestone 7: Performance Optimization