lookatitude/beluga-ai
Overview
This skill collects Go testing patterns and pragmatic conventions for Beluga AI v2 projects. It provides concrete examples for table-driven tests, stream cancellation, mocks, integration tags, and benchmarks to speed reliable test development. Use it to standardize tests, surface common pitfalls, and ensure consistent test layout and assertions.
How this skill works
The skill inspects common test scenarios and supplies short, actionable examples: table-driven unit tests, stream handling with context cancellation, and bench/test build tags. It documents mock placement and structure, preferred assertion libraries, compile-time interface checks, and mandatory test cases to cover error paths and empty inputs. Patterns are minimal and meant to be copied into *_test.go files alongside source code.
When to use it
- Writing unit tests for models and handlers
- Adding stream tests that must handle context cancellation
- Creating mocks with injected errors and call counting
- Authoring integration tests or benchmarks
- Enforcing compile-time interface conformance
Best practices
- Place tests in *_test.go files next to the code they exercise, not in separate directories
- Use table-driven tests for multiple scenarios and t.Run for subtests
- Favor testify/require for fatal assertions and testify/assert for non-fatal checks
- Always test error paths, nil/empty inputs, and context cancellation for streams
- Use //go:build integration for integration tests and *_integration_test.go naming
- For benchmarks include b.ReportAllocs() and b.RunParallel() when appropriate
Example use cases
- Unit test a Generate function with a table of inputs and expected outputs
- Test a streaming API that must cancel correctly using context.WithCancel
- Create a package mock with configurable function fields, error injection, and call counters under internal/testutil/mock<package>/
- Add a compile-time interface conformance check: var _ Interface = (*Impl)(nil)
- Write integration tests guarded by the integration build tag and separate benchmark files for performance
FAQ
Keep mocks under internal/testutil/mock<package>/ with function fields, error injection, and counters.
What assertion libraries to use?
Use testify/require for fatal checks and testify/assert for non-fatal assertions.
11 skills
This skill helps you apply Go testing patterns to write robust tests, mocks, and benchmarks with clear structure and coverage.
This skill helps design Go framework architecture by applying registry, lifecycle, and middleware patterns to packages and providers.
This skill helps implement streaming patterns in Go using iter.Seq2, enabling backpressure-aware streaming, transforms, and efficient data flow.
This skill helps you implement website development patterns using Astro 5, Tailwind, and Starlight to build responsive, accessible UI.
This skill guides you through adding a new provider (LLM, VectorStore, etc.) to Beluga AI with directory layout, interface implementation, and testing.
This skill guides you to design a comprehensive Beluga AI Go test suite with mocks, performance tests, and OTEL validation.
This skill guides you in designing a new Go component following ISP, DIP, and SRP for clean architecture and extensibility.
This skill helps you enforce architectural compliance by guiding systematic reviews against Beluga AI patterns and layer boundaries.
This skill guides you to create a standardized Go package in Beluga AI, including structure, interfaces, metrics, and validation.
This skill helps researchers explore Go codebase topics, document patterns, and provide evidence-based recommendations for design decisions.
This skill guides end-to-end feature implementation in Beluga AI, enforcing ISP patterns, configuration, metrics, and robust error handling.