MCPcopy Create free account
hub / github.com/go-dev-frame/sponge / Test_userExampleService_List

Function Test_userExampleService_List

internal/service/userExample_test.go:183–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

181}
182
183func Test_userExampleService_List(t *testing.T) {
184 s := newUserExampleService()
185 defer s.Close()
186 testData := s.TestData.(*model.UserExample)
187
188 // column names and corresponding data
189 rows := sqlmock.NewRows([]string{"id"}).
190 AddRow(testData.ID)
191
192 s.MockDao.SQLMock.ExpectQuery("SELECT .*").WillReturnRows(rows)
193
194 reply, err := s.IServiceClient.(serverNameExampleV1.UserExampleClient).List(s.Ctx, &serverNameExampleV1.ListUserExampleRequest{
195 Params: &types.Params{
196 Page: 0,
197 Limit: 10,
198 Sort: "ignore count", // ignore test count
199 },
200 })
201 assert.NoError(t, err)
202 t.Log(reply.String())
203
204 // get error test
205 reply, err = s.IServiceClient.(serverNameExampleV1.UserExampleClient).List(s.Ctx, &serverNameExampleV1.ListUserExampleRequest{
206 Params: &types.Params{
207 Page: 0,
208 Limit: 10,
209 },
210 })
211 assert.Error(t, err)
212}
213
214func Test_convertUserExample(t *testing.T) {
215 testData := &model.UserExample{}

Callers

nothing calls this directly

Calls 5

newUserExampleServiceFunction · 0.85
CloseMethod · 0.65
ListMethod · 0.65
StringMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected