Skip to content

Testing & CI/CD

This guide covers the testing frameworks, commands, and CI/CD practices used across the Merq platform.

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.go files 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.go suffix and tagged with // +build integration. These tests run against a real database instance managed by Docker.

To run all unit tests:

Terminal window
go test ./...

The Makefile provides a convenient way to manage the integration test environment:

  1. Start the test database:
    Terminal window
    make integration-up
  2. Run the integration tests:
    Terminal window
    make test-integration
  3. Stop and clean up the database:
    Terminal window
    make integration-down

The project includes a script to measure test coverage, with a focus on the internal/service package.

To run the coverage report:

Terminal window
./scripts/test_coverage.sh

The 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%.

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.

The React Native mobile app uses Jest as its testing framework, as configured in jest.config.js.

To run the Jest test suite:

Terminal window
yarn test

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 renderHook to 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.