Testing & CI/CD
This guide covers the testing frameworks, commands, and CI/CD practices used across the Merq platform.
Backend (merq-backend)
Section titled “Backend (merq-backend)”Testing Framework
Section titled “Testing Framework”The Go backend uses the standard go test command along with the popular testify library for assertions and mocking (testify/assert, testify/mock).
Tests are organized following Go’s conventions:
- Unit Tests: Reside in
*_test.gofiles alongside the code they are testing. They mock dependencies (e.g., mocking the repository when testing a service). - Integration Tests: Grouped in files with a
_test.gosuffix and tagged with// +build integration. These tests run against a real database instance managed by Docker.
Running Tests
Section titled “Running Tests”Unit Tests
Section titled “Unit Tests”To run all unit tests:
go test ./...Integration Tests
Section titled “Integration Tests”The Makefile provides a convenient way to manage the integration test environment:
- Start the test database:
Terminal window make integration-up - Run the integration tests:
Terminal window make test-integration - Stop and clean up the database:
Terminal window make integration-down
Test Coverage
Section titled “Test Coverage”The project includes a script to measure test coverage, with a focus on the internal/service package.
To run the coverage report:
./scripts/test_coverage.shThe script will output a summary and a detailed table of coverage per function, with a CI/CD gate requiring the service layer to meet a minimum coverage threshold of 80%.
Web Dashboard (merq-web)
Section titled “Web Dashboard (merq-web)”No test configuration files (jest.config.*, vitest.config.*) were found in merq-web/. Testing infrastructure for the web dashboard has not been set up yet.
Mobile App (merq-mobile)
Section titled “Mobile App (merq-mobile)”The React Native mobile app uses Jest as its testing framework, as configured in jest.config.js.
Running Tests
Section titled “Running Tests”To run the Jest test suite:
yarn testTesting Strategy
Section titled “Testing Strategy”Tests are written using React Native Testing Library and focus on:
- Screen flows: Verifying navigation, data display, and state changes from a user’s perspective.
- Hooks: Using
renderHookto test the logic within custom hooks, especially TanStack Query hooks. - Offline Behavior: Mocking network conditions to ensure the app functions correctly when offline.
No .github/workflows or other CI/CD pipeline configuration files have been found in the repository. Deployments are currently done manually using the procedures described in the Manual Deployment and Dokploy guides.