ReadRealm uses Jest for the NestJS backend, Flutter’s built-in test runner for the admin dashboard, Gradle for Android, andDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/aliammari1/readrealm/llms.txt
Use this file to discover all available pages before exploring further.
xcodebuild for iOS. This page covers how to run all of them.
Run all tests
To run the full test suite (backend + dashboard) in a single command:task api:test followed by task dashboard:test.
Backend testing
The backend uses Jest configured inapps/api/package.json. Unit test files live in apps/api/src/ and match the pattern **/*.spec.ts. E2E tests are in apps/api/test/.
- Unit tests
- E2E tests
- Coverage
- Watch mode
Aim for greater than 80% coverage on new backend code. Coverage reports are available in
apps/api/coverage/ after running npm run test:cov.Dashboard testing
The admin dashboard uses Flutter’s built-in test runner.- All tests
- Single test file
- Coverage
Android testing
Android unit tests run via Gradle.iOS testing
iOS tests run viaxcodebuild.
Test structure overview
The NestJS backend co-locates spec files next to their source files, following NestJS conventions:Tips for writing good tests
Backend (NestJS / Jest)
Backend (NestJS / Jest)
- Use
@nestjs/testingto create isolated test modules withTest.createTestingModule(). - Mock external dependencies (MongoDB, third-party APIs) rather than calling them in unit tests.
- Use descriptive
describeanditblocks so failures are easy to locate. - Keep unit tests fast — reserve real database connections for E2E tests.
- Write at least one test for each controller endpoint and service method.
Dashboard (Flutter)
Dashboard (Flutter)
- Use Flutter’s
testWidgetsfor widget tests andtestfor pure Dart unit tests. - Use
Provideroverrides or mocks to isolate business logic from the widget under test. - Use
flutter test --coverageregularly to identify untested branches. - Write widget tests for all new UI components.
Android (Kotlin / Gradle)
Android (Kotlin / Gradle)
- Use JUnit 4 or JUnit 5 for unit tests.
- Mock API responses with a test double rather than hitting a live server.
- Test on API level 24 and above to match the supported range.
iOS (Swift / Xcode)
iOS (Swift / Xcode)
- Use XCTest for unit and UI tests.
- Test across different device sizes using Xcode simulators.
- Handle async operations with
XCTestExpectationor Swift concurrency helpers.