MCPcopy Create free account
hub / github.com/github/gh-aw / TestRepoMemoryConfigObject

Function TestRepoMemoryConfigObject

pkg/workflow/repo_memory_test.go:61–106  ·  view source on GitHub ↗

TestRepoMemoryConfigObject tests repo-memory configuration with object notation

(t *testing.T)

Source from the content-addressed store, hash-verified

59
60// TestRepoMemoryConfigObject tests repo-memory configuration with object notation
61func TestRepoMemoryConfigObject(t *testing.T) {
62 toolsMap := map[string]any{
63 "repo-memory": map[string]any{
64 "target-repo": "myorg/myrepo",
65 "branch-name": "memory/custom",
66 "max-file-size": 524288,
67 "description": "Custom memory store",
68 },
69 }
70
71 toolsConfig, err := ParseToolsConfig(toolsMap)
72 if err != nil {
73 t.Fatalf("Failed to parse tools config: %v", err)
74 }
75
76 compiler := NewCompiler()
77 config, err := compiler.extractRepoMemoryConfig(toolsConfig, "")
78 if err != nil {
79 t.Fatalf("Failed to extract repo-memory config: %v", err)
80 }
81
82 if config == nil {
83 t.Fatal("Expected non-nil config")
84 }
85
86 if len(config.Memories) != 1 {
87 t.Fatalf("Expected 1 memory, got %d", len(config.Memories))
88 }
89
90 memory := config.Memories[0]
91 if memory.TargetRepo != "myorg/myrepo" {
92 t.Errorf("Expected target-repo 'myorg/myrepo', got '%s'", memory.TargetRepo)
93 }
94
95 if memory.BranchName != "memory/custom" {
96 t.Errorf("Expected branch name 'memory/custom', got '%s'", memory.BranchName)
97 }
98
99 if memory.MaxFileSize != 524288 {
100 t.Errorf("Expected max file size 524288, got %d", memory.MaxFileSize)
101 }
102
103 if memory.Description != "Custom memory store" {
104 t.Errorf("Expected description 'Custom memory store', got '%s'", memory.Description)
105 }
106}
107
108// TestRepoMemoryConfigArray tests repo-memory configuration with array notation
109func TestRepoMemoryConfigArray(t *testing.T) {

Callers

nothing calls this directly

Calls 4

ParseToolsConfigFunction · 0.85
NewCompilerFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected