From 745c994c4e2ee3438d8a82cce15f3aa18e58a8f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D7=A0=CF=85=CE=B1=CE=B7=20=D7=A0=CF=85=CE=B1=CE=B7=D1=95?= =?UTF-8?q?=CF=83=CE=B7?= Date: Thu, 5 Mar 2026 16:12:13 -0800 Subject: [PATCH] docs: add one-suite-method-per-function test rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clarify that all scenarios for a function (success, errors, edge cases) belong as rows in a single table-driven test — never split into separate TestFoo, TestFooError, TestFooNilResponse methods. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- CLAUDE.md | 1 + docs/docs/sidebar/development/development.md | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 995e7c74..c88029c2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -266,6 +266,7 @@ Conventions: - Suite naming: `*_public_test.go` → `{Name}PublicTestSuite`, `*_test.go` → `{Name}TestSuite` - Table-driven structure with `validateFunc` callbacks +- One suite method per function under test — all scenarios (success, errors, edge cases) as rows in one table - Avoid generic file names like `helpers.go` or `utils.go` — name files after what they contain diff --git a/docs/docs/sidebar/development/development.md b/docs/docs/sidebar/development/development.md index 462e8d10..97fe0dbe 100644 --- a/docs/docs/sidebar/development/development.md +++ b/docs/docs/sidebar/development/development.md @@ -97,6 +97,12 @@ Unit tests should follow the Go convention of being located in a file named located in `test/integration/` and use a `//go:build integration` tag. They build and start a real `osapi` binary, so they require no external setup. +Use `testify/suite` with table-driven patterns and `validateFunc` callbacks. +**One suite method per function under test.** All scenarios for a function +(success, error codes, transport failures, nil responses) belong as rows in a +single table — never split into separate `TestFoo`, `TestFooError`, +`TestFooNilResponse` methods. + ### File naming Avoid generic file names like `helpers.go` or `utils.go`. Name files after what