28 lines
712 B
Go
28 lines
712 B
Go
package service
|
|
|
|
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)
|
|
}
|
|
}
|