kra-new/internal/service/system/dictionary_test.go

28 lines
711 B
Go

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)
}
}