forked from molecule-ai/molecule-core
fix(test): resolve 4 compile errors in workspace_provision_test.go
Issue #1366: Handlers test package broken on main. Changes: - Wrap orphaned largeContent declarations in TestSeedInitialMemories_ContentOverLimit (was outside any function) - ExpectExpectations → ExpectationsWereMet (3 occurrences, sqlmock API) - mockEnvMutator.Register(interface{}) → Register(provisionhook.EnvMutator) to match pkg/provisionhook Registry.Register signature - mockResolver missing Scheme() method (SourceResolver interface req) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
657d07a3d8
commit
eaadf72e2d
@ -570,7 +570,7 @@ func TestSeedInitialMemories_TruncatesOversizedContent(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
mock.ExpectExpectations()
|
||||
mock.ExpectationsWereMet()
|
||||
workspaceID := "ws-trunc-" + tt.name
|
||||
content := strings.Repeat("X", tt.contentLen)
|
||||
memories := []models.MemorySeed{{Content: content, Scope: "LOCAL"}}
|
||||
@ -624,7 +624,7 @@ func TestSeedInitialMemories_RedactsSecrets(t *testing.T) {
|
||||
// unrecognized scope value are silently skipped (not inserted).
|
||||
func TestSeedInitialMemories_InvalidScopeSkipped(t *testing.T) {
|
||||
mock := setupTestDB(t)
|
||||
mock.ExpectExpectations() // no DB calls expected for invalid scope
|
||||
mock.ExpectationsWereMet() // no DB calls expected for invalid scope
|
||||
|
||||
memories := []models.MemorySeed{
|
||||
{Content: "this should be skipped", Scope: "NOT_A_REAL_SCOPE"},
|
||||
@ -641,7 +641,7 @@ func TestSeedInitialMemories_InvalidScopeSkipped(t *testing.T) {
|
||||
// is handled without error (no DB calls).
|
||||
func TestSeedInitialMemories_EmptyMemoriesNil(t *testing.T) {
|
||||
mock := setupTestDB(t)
|
||||
mock.ExpectExpectations()
|
||||
mock.ExpectationsWereMet()
|
||||
|
||||
seedInitialMemories(context.Background(), "ws-nil", nil, "test-ns")
|
||||
|
||||
@ -906,8 +906,6 @@ func containsStr(s, substr string) bool {
|
||||
// truncates content at maxMemoryContentLength before INSERT. Regression
|
||||
// test for the error-sanitization / memory-seed contract.
|
||||
func TestSeedInitialMemories_Truncation(t *testing.T) {
|
||||
mock := setupTestDB(t)
|
||||
|
||||
largeContent := string(make([]byte, 100_001))
|
||||
copy([]byte(largeContent), "X") // fill with "X" so test is deterministic
|
||||
|
||||
@ -1184,7 +1182,7 @@ func (m *mockEnvMutator) Run(_ context.Context, _ string, _ map[string]string) e
|
||||
return m.returnErr
|
||||
}
|
||||
|
||||
func (m *mockEnvMutator) Register(_ interface{}) {}
|
||||
func (m *mockEnvMutator) Register(_ provisionhook.EnvMutator) {}
|
||||
|
||||
// TestResolveAndStage_NoInternalErrorsInHTTPErr asserts that resolveAndStage
|
||||
// never puts err.Error() in HTTP error responses. Tests plugin source
|
||||
@ -1263,6 +1261,8 @@ func (m *mockPluginsSources) Resolve(source plugins.Source) (plugins.SourceResol
|
||||
|
||||
type mockResolver struct{}
|
||||
|
||||
func (*mockResolver) Scheme() string { return "" }
|
||||
|
||||
func (*mockResolver) Fetch(ctx context.Context, spec, destDir string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user