17 lines
477 B
Go
17 lines
477 B
Go
package service
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"kra/internal/modules/system/biz"
|
|
)
|
|
|
|
func TestDepartmentResponsePreservesNilAndEmptyChildren(t *testing.T) {
|
|
if got := departmentResponse(&biz.Department{}).Children; got != nil {
|
|
t.Fatalf("single/search department children = %#v, want nil", got)
|
|
}
|
|
if got := departmentResponse(&biz.Department{Children: []*biz.Department{}}).Children; got == nil || len(got) != 0 {
|
|
t.Fatalf("tree leaf children = %#v, want empty slice", got)
|
|
}
|
|
}
|