rtc_prd/.cursor/rules/flutter-testing.mdc
seaislee1209 066eb8f820 feat: music-creation page + MiniMax API integration + Flutter dev setup
Music Creation Page:
- Vinyl 3D flip to view lyrics, tonearm animation, glow rotation effect
- Circular SVG progress ring, speech bubble feedback, confirm dialog
- Playlist modal, free creation input, lyrics formatting optimization
- MiniMax API real music generation with SSE streaming progress

Backend:
- FastAPI proxy server.py for MiniMax API calls
- Music + lyrics file persistence to Capybara music/ directory
- GET /api/playlist endpoint for auto-building playlist from files

UI/UX Refinements:
- frontend-design skill compliance across all pages
- Glassmorphism effects, modal interactions, scroll tap prevention
- iPhone 12 Pro responsive layout (390x844)

Flutter Development Preparation:
- Installed flutter-expert skill with 6 reference docs
- Added 5 Cursor Rules: official Flutter, clean architecture, UI performance, testing, Dart standards

Assets:
- 9 Capybara music MP3 files + lyrics TXT files
- MiniMax API documentation

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:23:19 +08:00

44 lines
1.5 KiB
Plaintext

---
description: Flutter testing guidelines covering unit, widget, and integration tests.
globs: "test/**/*.dart"
---
# Flutter Testing Rules
## Test Structure
- Follow Arrange-Act-Assert (Given-When-Then) pattern.
- Name test variables clearly: inputX, mockX, actualX, expectedX.
- Mirror lib/ directory structure in test/.
- One test file per source file.
## Unit Tests
- Write unit tests for all domain logic and use cases.
- Test repository implementations with mock data sources.
- Test BLoC/Cubit state transitions thoroughly.
- Use package:test for pure Dart unit tests.
## Widget Tests
- Use package:flutter_test for widget tests.
- Test rendering, interaction, and state changes.
- Use pumpWidget() and pump() for async rendering.
- Use find.byType, find.byKey, find.text for assertions.
- Verify widget rebuilds correctly with different states.
## Integration Tests
- Use package:integration_test for end-to-end flows.
- Test critical user journeys (login, navigation, data flow).
- Add integration_test as dev_dependency with sdk: flutter.
## Mocking
- Prefer fakes and stubs over mocks.
- Use mockito or mocktail when mocks are necessary.
- Avoid code generation for mocks when possible.
- Mock external services (APIs, databases) at repository boundary.
## Best Practices
- Aim for high test coverage on domain and data layers.
- Test error states and edge cases.
- Keep tests fast and independent.
- Use setUp() and tearDown() for common setup.
- Run tests in CI/CD pipeline.