Skip to content

Commit

Permalink
refactor: more accurate naming
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Jul 20, 2024
1 parent 6bf38aa commit c347ec1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/net/yoshinorin/qualtet/Modules.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Modules(tx: Transactor[IO]) {
val config = ApplicationConfig.load

given log4catsLogger: Log4CatsLoggerFactory[IO] = Log4CatsSlf4jFactory.create[IO]
given dbContext: DoobieExecuter = new DoobieExecuter(tx)
given doobieExecuterContext: DoobieExecuter = new DoobieExecuter(tx)

val migrator: Migrator = new Migrator(config.db)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import cats.effect.unsafe.implicits.global
// testOnly net.yoshinorin.qualtet.domains.contentTaggings.ContentTaggingServiceSpec
class ContentTaggingServiceSpec extends AnyWordSpec with BeforeAndAfterAll {

given dbContext: DoobieExecuter = new DoobieExecuter(fixtureTx)
given doobieExecuterContext: DoobieExecuter = new DoobieExecuter(fixtureTx)

val requestContents: List[RequestContent] = {
List(1, 2)
Expand Down Expand Up @@ -44,7 +44,7 @@ class ContentTaggingServiceSpec extends AnyWordSpec with BeforeAndAfterAll {
val contents = contentService.findByPathWithMeta(Path("/test/ContentTaggingServiceSpec-1")).unsafeRunSync().get
val shouledDeleteContentTaggings = (contents1.id, Seq(contents.tags.head.id, contents.tags.last.id))

dbContext.transact(contentTaggingService.bulkDeleteActions(shouledDeleteContentTaggings)).unsafeRunSync()
doobieExecuterContext.transact(contentTaggingService.bulkDeleteActions(shouledDeleteContentTaggings)).unsafeRunSync()
val result = contentService.findByPathWithMeta(Path("/test/ContentTaggingServiceSpec-1")).unsafeRunSync().get

assert(result.tags.size === 1)
Expand All @@ -53,7 +53,7 @@ class ContentTaggingServiceSpec extends AnyWordSpec with BeforeAndAfterAll {

"not be delete any tag" in {
val beforeDelete = contentService.findByPath(Path("/test/ContentTaggingServiceSpec-2")).unsafeRunSync().get
dbContext.transact(contentTaggingService.bulkDeleteActions(beforeDelete.id, Seq())).unsafeRunSync()
doobieExecuterContext.transact(contentTaggingService.bulkDeleteActions(beforeDelete.id, Seq())).unsafeRunSync()
val afterDelete = contentService.findByPathWithMeta(Path("/test/ContentTaggingServiceSpec-2")).unsafeRunSync().get

assert(afterDelete.tags.size === 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import cats.effect.unsafe.implicits.global
// testOnly net.yoshinorin.qualtet.domains.TagServiceSpec
class TagServiceSpec extends AnyWordSpec with BeforeAndAfterAll {

given dbContext: DoobieExecuter = new DoobieExecuter(fixtureTx)
given doobieExecuterContext: DoobieExecuter = new DoobieExecuter(fixtureTx)

val requestContents = makeRequestContents(10, "tagService")

Expand Down Expand Up @@ -42,7 +42,7 @@ class TagServiceSpec extends AnyWordSpec with BeforeAndAfterAll {
"findByContentId" in {
val r = (for {
c <- contentService.findByPath(Path("/test/tagService-4"))
t <- dbContext.transact(tagService.findByContentIdActions(c.get.id))
t <- doobieExecuterContext.transact(tagService.findByContentIdActions(c.get.id))
} yield t).unsafeRunSync()
assert(r.head.name === TagName("tagServiceTag4"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object Fixture {
)
private val modules = Modules(fixtureTx)
given log4catsLogger: Log4CatsLoggerFactory[IO] = Log4CatsSlf4jFactory.create[IO]
given dbContext: DoobieExecuter = new DoobieExecuter(fixtureTx)
given doobieExecuterContext: DoobieExecuter = new DoobieExecuter(fixtureTx)

val migrator = modules.migrator
val articleService = modules.articleService
Expand Down

0 comments on commit c347ec1

Please sign in to comment.