on main help sign in
docs: add testing guidelines for mock providers
commite3b55cebdfc2f2917592097b9bab3a1d49c30f95 authorKujtim Hoxha <kujtimii.h@gmail.com> dateFri 27 Jun 2025, 17:47 (1 year ago) parent1649dd0
1 file changed+28
CRUSH.md+28
CRUSH.md+28
@@ -24,6 +24,34 @@
2424- **File permissions**: Use octal notation (0o755, 0o644) for file permissions
2525- **Comments**: End comments in periods unless comments are at the end of the line.
2626
27+## Testing with Mock Providers
28+
29+When writing tests that involve provider configurations, use the mock providers to avoid API calls:
30+
31+```go
32+func TestYourFunction(t *testing.T) {
33+ // Enable mock providers for testing
34+ originalUseMock := config.UseMockProviders
35+ config.UseMockProviders = true
36+ defer func() {
37+ config.UseMockProviders = originalUseMock
38+ config.ResetProviders()
39+ }()
40+
41+ // Reset providers to ensure fresh mock data
42+ config.ResetProviders()
43+
44+ // Your test code here - providers will now return mock data
45+ providers := config.Providers()
46+ // ... test logic
47+}
48+```
49+
50+The mock providers include:
51+- **Anthropic**: claude-3-opus, claude-3-haiku, claude-3-5-sonnet-20241022, claude-3-5-haiku-20241022
52+- **OpenAI**: gpt-4, gpt-3.5-turbo, gpt-4-turbo, gpt-4o, gpt-4o-mini
53+- **Gemini**: gemini-2.5-pro, gemini-2.5-flash
54+
2755## Formatting
2856
2957- ALWAYS format any Go code you write.