diff --git a/cmd/server/tests/test_helpers_test.go b/cmd/server/tests/test_helpers_test.go index 82c3004..a73621d 100644 --- a/cmd/server/tests/test_helpers_test.go +++ b/cmd/server/tests/test_helpers_test.go @@ -616,6 +616,17 @@ func setupTestServer(t *testing.T) *TestServerSetup { // Register cleanup function to run automatically when test completes t.Cleanup(func() { + // Clean up test libraries created by this test + ctx := context.Background() + allLibs, err := queries.ListLibraries(ctx) + if err == nil { + for _, lib := range allLibs { + if strings.Contains(strings.ToLower(lib.Name), "test") { + queries.DeleteLibrary(ctx, lib.ID) + } + } + } + if err := setup.Close(); err != nil { t.Errorf("Failed to cleanup test server: %v", err) }