- Add ListRecipes and ListAvailablePrompts functions - Update MCP server handlers for local/global recipes and prompts - Add unit tests for analyze, docs, mcp, prompts, recipe, and testgen packages
31 lines
725 B
Go
31 lines
725 B
Go
package docs
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestBuildDocsMessages(t *testing.T) {
|
|
tests := []struct {
|
|
language string
|
|
code string
|
|
styleCheck string
|
|
}{
|
|
{language: "Go", code: "func Foo() {}", styleCheck: "godoc"},
|
|
{language: "Python", code: "def foo(): pass", styleCheck: "PEP 257"},
|
|
{language: "JavaScript", code: "function foo() {}", styleCheck: "JSDoc"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.language, func(t *testing.T) {
|
|
msgs := BuildDocsMessages(tt.language, tt.code)
|
|
|
|
assert.Len(t, msgs, 2)
|
|
assert.Equal(t, "system", msgs[0]["role"])
|
|
assert.Equal(t, "user", msgs[1]["role"])
|
|
assert.Contains(t, msgs[0]["content"], tt.styleCheck)
|
|
})
|
|
}
|
|
}
|