forked from longtao.wu/droboticflow
31 lines
818 B
Go
31 lines
818 B
Go
package store
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"droboticflow/internal/domain"
|
|
)
|
|
|
|
func TestProjectPersistenceDocumentKeepsEmptyEditableFields(t *testing.T) {
|
|
document := projectPersistenceDocument(domain.ProjectRecord{
|
|
ID: "project-clear-fields",
|
|
Name: "Clear fields",
|
|
Description: "",
|
|
Customer: "",
|
|
Scene: "",
|
|
DataBatch: "",
|
|
})
|
|
for _, field := range []string{"description", "customer", "scene", "dataBatch", "annotationStandard", "storagePrefix"} {
|
|
value, exists := document[field]
|
|
if !exists {
|
|
t.Fatalf("editable field %q was omitted from Mongo update", field)
|
|
}
|
|
if value != "" {
|
|
t.Fatalf("editable field %q = %#v, want empty string", field, value)
|
|
}
|
|
}
|
|
if _, exists := document["workflowCount"]; exists {
|
|
t.Fatal("derived workflowCount must not be persisted")
|
|
}
|
|
}
|