优化结构

This commit is contained in:
Yvan
2026-08-22 23:02:44 +08:00
parent b18baf1547
commit 64459574b2
16 changed files with 158 additions and 73 deletions
@@ -96,3 +96,14 @@ func TestIntegrationConfigTestDoesNotPersistCandidate(t *testing.T) {
t.Fatalf("tested values = %#v", values)
}
}
func TestIntegrationConfigRejectsJSONNull(t *testing.T) {
repo := &integrationConfigRepoTestDouble{}
usecase := NewIntegrationConfigUsecase(repo, &integrationConnectionTesterDouble{})
if err := usecase.Save(context.Background(), &IntegrationConfig{Kind: IntegrationKindMQ, Provider: "emqx", Values: json.RawMessage("null")}); err == nil {
t.Fatal("Save() accepted JSON null as an object")
}
if err := usecase.Test(context.Background(), &IntegrationConfig{Kind: IntegrationKindMQ, Provider: "emqx", Values: json.RawMessage("null")}); err == nil {
t.Fatal("Test() accepted JSON null as an object")
}
}