package keeper_test

import (
	"testing"

	"github.com/stretchr/testify/require"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"

	"<%= ModulePath %>/x/<%= ModuleName %>/keeper"
	"<%= ModulePath %>/x/<%= ModuleName %>/types"
)

func Test<%= TypeName.UpperCamel %>Query(t *testing.T) {
	f := initFixture(t)
	qs := keeper.NewQueryServerImpl(f.keeper)
	item := types.<%= TypeName.PascalCase %>{}
	err := f.keeper.<%= TypeName.UpperCamel %>.Set(f.ctx, item)
	require.NoError(t, err)

	tests := []struct {
		desc     string
		request  *types.QueryGet<%= TypeName.PascalCase %>Request
		response *types.QueryGet<%= TypeName.PascalCase %>Response
		err      error
	}{
		{
			desc:     "First",
			request:  &types.QueryGet<%= TypeName.PascalCase %>Request{},
			response: &types.QueryGet<%= TypeName.PascalCase %>Response{<%= TypeName.UpperCamel %>: item},
		},
		{
			desc: "InvalidRequest",
			err:  status.Error(codes.InvalidArgument, "invalid request"),
		},
	}
	for _, tc := range tests {
		t.Run(tc.desc, func(t *testing.T) {
			response, err := qs.Get<%= TypeName.PascalCase %>(f.ctx, tc.request)
			if tc.err != nil {
				require.ErrorIs(t, err, tc.err)
			} else {
				require.NoError(t, err)
				require.EqualExportedValues(t, tc.response, response)
			}
		})
	}
}

