package service

import (
	"context"
	"testing"

	"kra/internal/biz"
)

type dictionaryExportRepo struct {
	biz.DictionaryRepo
	value *biz.Dictionary
}

func (r dictionaryExportRepo) ExportDictionary(context.Context, uint) (*biz.Dictionary, error) {
	return r.value, nil
}

func TestExportDictionaryPreservesNilDetails(t *testing.T) {
	service := NewDictionaryService(biz.NewDictionaryUsecase(dictionaryExportRepo{value: &biz.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)
	}
}
