Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
CorrectRoadH committed Aug 5, 2024
1 parent 5d104e3 commit c2fb315
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions service/ysk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ import (
"gotest.tools/assert"
)

func setup(t *testing.T) *service.YSKService {
func setup(t *testing.T) (*service.YSKService, func()) {
repository, err := repository.NewDatabaseRepositoryInMemory()
assert.NilError(t, err)

yskService := service.NewYSKService(&repository)
return yskService
return yskService, func() {
repository.Close()
}
}

func TestInsertAndGetCardList(t *testing.T) {
yskService := setup(t)
yskService, cleanup := setup(t)
defer cleanup()

cardList, err := yskService.YskCardList(context.Background())
assert.NilError(t, err)
Expand Down Expand Up @@ -51,7 +54,8 @@ func TestInsertAndGetCardList(t *testing.T) {
}

func TestInsertAllTypeCardList(t *testing.T) {
yskService := setup(t)
yskService, cleanup := setup(t)
defer cleanup()

cardList, err := yskService.YskCardList(context.Background())
assert.NilError(t, err)
Expand Down

0 comments on commit c2fb315

Please sign in to comment.