优化结构
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"kra/internal/biz/system"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDepartmentResponsePreservesNilAndEmptyChildren(t *testing.T) {
|
||||
if got := departmentResponse(&system.Department{}).Children; got != nil {
|
||||
t.Fatalf("single/search department children = %#v, want nil", got)
|
||||
}
|
||||
if got := departmentResponse(&system.Department{Children: []*system.Department{}}).Children; got == nil || len(got) != 0 {
|
||||
t.Fatalf("tree leaf children = %#v, want empty slice", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user