aboutsummaryrefslogtreecommitdiffstats
path: root/DOCS/testing.md
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-17 19:34:08 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-17 19:35:55 -0800
commit5c5f440085255bf7f11af589faa4fa14d74f9294 (patch)
treedcce0b145c199e4fef9ce2832b0b1da55a17cc6a /DOCS/testing.md
parent9db36ae402dbb74f7223a4efc8b2483086684e38 (diff)
downloadneko-5c5f440085255bf7f11af589faa4fa14d74f9294.tar.gz
neko-5c5f440085255bf7f11af589faa4fa14d74f9294.tar.bz2
neko-5c5f440085255bf7f11af589faa4fa14d74f9294.zip
Fix scrolling behavior, CI linting, and update Dockerfile
Diffstat (limited to 'DOCS/testing.md')
-rw-r--r--DOCS/testing.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/DOCS/testing.md b/DOCS/testing.md
new file mode 100644
index 0000000..40eb12f
--- /dev/null
+++ b/DOCS/testing.md
@@ -0,0 +1,48 @@
+# Testing Strategy
+
+This document outlines the testing procedures for Neko, both locally and in Continuous Integration (CI).
+
+## Local Development
+
+Developers should run tests locally before pushing changes. The `Makefile` provides several targets for this purpose:
+
+- `make test`: Runs backend tests with coverage and frontend unit tests.
+- `make lint`: Runs `golangci-lint` using the project's configuration.
+- `make check`: Runs both linting and tests.
+- `make ui-check`: Verifies that the built frontend assets in `web/dist/v3` match the current source code (ensures `make all` was run).
+- `make test-race`: Runs backend tests with the race detector enabled.
+
+### Git Hooks
+
+It is recommended to use the provided git hooks to ensure tests pass before committing. Run `make install-hooks` to set them up.
+
+## Continuous Integration (CI)
+
+Our GitHub Actions workflow (`.github/workflows/ci.yml`) mimics the local environment to ensure consistency.
+
+### Backend (Go)
+
+- **Go Version**: 1.24 (or higher as specified).
+- **Linting**: Uses `golangci/golangci-lint-action` with `golangci-lint` v2.x. This provides annotations directly in Pull Requests.
+- **Tests**: Runs `go test -v -race ./...` to catch concurrency issues.
+
+### Frontend (Node.js)
+
+- **Node Version**: 20.x.
+- **Tests**: Runs `npm test` in the `frontend-vanilla` directory.
+
+### Build Consistency
+
+- **UI Check**: Runs `make ui-vanilla` and checks for diffs in `web/dist/v3`. This ensures that the production assets checked into the repository are up-to-date with the frontend source code.
+
+### Docker
+
+- **Docker Build**: Verifies that the `Dockerfile` builds successfully.
+- **Integration Test**: Uses `docker compose` to start the service and verifies it responds to HTTP requests on port 8080.
+
+## Why this structure?
+
+1. **Consistency**: Use of similar tools (Go, Node, golangci-lint) locally and in CI reduces "works on my machine" issues.
+2. **Race Detection**: Always run with `-race` in CI to find subtle bugs that might be missed during quick local tests.
+3. **Asset Verification**: Since we check in built assets for ease of deployment, we must verify they are consistent with the source code.
+4. **Smoke Testing**: The Docker step ensures the final container is actually functional.