This directory contains unit tests for the ProjectFlow application. Unit tests focus on testing individual components and functions in isolation.
Each test file corresponds to a specific model or utility:
user_test.go: Tests the User model's validation and lifecycle methodsproject_test.go: Tests the Project model's validation and lifecycle methodstask_test.go: Tests the Task model's validation and lifecycle methodsjwt_test.go: Tests JWT token generation and validation
To run all unit tests:
make test-unitTo run a specific test file:
go test -v ./tests/unit/user_test.goTo generate a test coverage report:
make test-coverage- Each test should be independent and not rely on the state from other tests
- Use descriptive test names that explain what is being tested
- Use table-driven tests for testing multiple scenarios
- Use assertions from the
testify/assertpackage for clearer test failures