优化结构
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kra/internal/biz/system"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type dictionaryExportRepo struct {
|
||||
system.DictionaryRepo
|
||||
value *system.Dictionary
|
||||
}
|
||||
|
||||
func (r dictionaryExportRepo) ExportDictionary(context.Context, uint) (*system.Dictionary, error) {
|
||||
return r.value, nil
|
||||
}
|
||||
|
||||
func TestExportDictionaryPreservesNilDetails(t *testing.T) {
|
||||
service := NewDictionaryService(system.NewDictionaryUsecase(dictionaryExportRepo{value: &system.Dictionary{Name: "empty", Type: "empty"}}))
|
||||
result, err := service.ExportDictionary(context.Background(), 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if result.SysDictionaryDetails != nil {
|
||||
t.Fatalf("export details = %#v, want nil", result.SysDictionaryDetails)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user