diff --git a/src/test/scala/net/yoshinorin/qualtet/domains/archives/ArchiveServiceSpec.scala b/src/test/scala/net/yoshinorin/qualtet/domains/archives/ArchiveServiceSpec.scala index 53ad4b46..1b4fcbb4 100644 --- a/src/test/scala/net/yoshinorin/qualtet/domains/archives/ArchiveServiceSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/domains/archives/ArchiveServiceSpec.scala @@ -8,10 +8,9 @@ import cats.effect.unsafe.implicits.global // testOnly net.yoshinorin.qualtet.domains.ArchiveServiceSpec class ArchiveServiceSpec extends AnyWordSpec with BeforeAndAfterAll { - val requestContents = makeRequestContents(40, "archives") - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents = makeRequestContents(40, "archives") createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/domains/articles/ArticleServiceSpec.scala b/src/test/scala/net/yoshinorin/qualtet/domains/articles/ArticleServiceSpec.scala index 83060245..24b0d79d 100644 --- a/src/test/scala/net/yoshinorin/qualtet/domains/articles/ArticleServiceSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/domains/articles/ArticleServiceSpec.scala @@ -12,28 +12,27 @@ import cats.effect.unsafe.implicits.global // testOnly net.yoshinorin.qualtet.domains.ArticleServiceSpec class ArticleServiceSpec extends AnyWordSpec with BeforeAndAfterAll { - val sameTagNameRequestContents: List[RequestContent] = { - (1 until 15).toList - .map(_.toString()) - .map(i => - RequestContent( - contentType = "article", - path = Path(s"/test/same/tags/${i}"), - title = s"this is a same tag title ${i}", - rawContent = s"this is a same tag raw content ${i}", - htmlContent = s"this is a html content ${i}", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List("SameTag"), - externalResources = List() - ) - ) - } - - val requestContents = makeRequestContents(30, "articles") - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents = makeRequestContents(30, "articles") createContents(requestContents) + + val sameTagNameRequestContents: List[RequestContent] = { + (1 until 15).toList + .map(_.toString()) + .map(i => + RequestContent( + contentType = "article", + path = Path(s"/test/same/tags/${i}"), + title = s"this is a same tag title ${i}", + rawContent = s"this is a same tag raw content ${i}", + htmlContent = s"this is a html content ${i}", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List("SameTag"), + externalResources = List() + ) + ) + } createContents(sameTagNameRequestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingServiceSpec.scala b/src/test/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingServiceSpec.scala index d0dc769f..3d44aba7 100644 --- a/src/test/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingServiceSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/domains/contentSerializing/ContentSerializingServiceSpec.scala @@ -13,33 +13,32 @@ import org.scalatest.Ignore @Ignore // TODO: write testcode when implement delete feature class ContentSerializingServiceSpec extends AnyWordSpec with BeforeAndAfterAll { - val requestSeries: RequestSeries = RequestSeries( - title = "Content Serializing Service Spec", - name = SeriesName("content-serializing-service-spec"), - None - ) - - val requestContents: List[RequestContent] = { - List(1, 5) - .map(_.toString()) - .map(i => - RequestContent( - contentType = "article", - path = Path(s"/test/ContentSerializingServiceSpec-${i}"), - title = s"this is a ContentSerializingServiceSpec title ${i}", - rawContent = s"this is a ContentSerializingServiceSpec raw content ${i}", - htmlContent = s"this is a ContentSerializingServiceSpec html content ${i}", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"ContentSerializingServiceSpec${i}.1", s"ContentSerializingServiceSpec${i}.2", s"ContentSerializingServiceSpec${i}.3"), - series = Option(requestSeries.name), - externalResources = List() - ) - ) - } - override protected def beforeAll(): Unit = { - createSeries(List(requestSeries)) // NOTE: create content and related data for test + val requestSeries: RequestSeries = RequestSeries( + title = "Content Serializing Service Spec", + name = SeriesName("content-serializing-service-spec"), + None + ) + createSeries(List(requestSeries)) + + val requestContents: List[RequestContent] = { + List(1, 5) + .map(_.toString()) + .map(i => + RequestContent( + contentType = "article", + path = Path(s"/test/ContentSerializingServiceSpec-${i}"), + title = s"this is a ContentSerializingServiceSpec title ${i}", + rawContent = s"this is a ContentSerializingServiceSpec raw content ${i}", + htmlContent = s"this is a ContentSerializingServiceSpec html content ${i}", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"ContentSerializingServiceSpec${i}.1", s"ContentSerializingServiceSpec${i}.2", s"ContentSerializingServiceSpec${i}.3"), + series = Option(requestSeries.name), + externalResources = List() + ) + ) + } createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingServiceSpec.scala b/src/test/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingServiceSpec.scala index 8f22fa7e..661d23a7 100644 --- a/src/test/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingServiceSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/domains/contentTaggings/ContentTaggingServiceSpec.scala @@ -14,25 +14,24 @@ class ContentTaggingServiceSpec extends AnyWordSpec with BeforeAndAfterAll { given doobieExecuterContext: DoobieExecuter = new DoobieExecuter(fixtureTx) - val requestContents: List[RequestContent] = { - List(1, 2) - .map(_.toString()) - .map(i => - RequestContent( - contentType = "article", - path = Path(s"/test/ContentTaggingServiceSpec-${i}"), - title = s"this is a ContentTaggingServiceSpec title ${i}", - rawContent = s"this is a ContentTaggingServiceSpec raw content ${i}", - htmlContent = s"this is a ContentTaggingServiceSpec html content ${i}", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"ContentTaggingServiceSpec${i}.1", s"ContentTaggingServiceSpec${i}.2", s"ContentTaggingServiceSpec${i}.3"), - externalResources = List() - ) - ) - } - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents: List[RequestContent] = { + List(1, 2) + .map(_.toString()) + .map(i => + RequestContent( + contentType = "article", + path = Path(s"/test/ContentTaggingServiceSpec-${i}"), + title = s"this is a ContentTaggingServiceSpec title ${i}", + rawContent = s"this is a ContentTaggingServiceSpec raw content ${i}", + htmlContent = s"this is a ContentTaggingServiceSpec html content ${i}", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"ContentTaggingServiceSpec${i}.1", s"ContentTaggingServiceSpec${i}.2", s"ContentTaggingServiceSpec${i}.3"), + externalResources = List() + ) + ) + } createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/domains/feeds/FeedServiceSpec.scala b/src/test/scala/net/yoshinorin/qualtet/domains/feeds/FeedServiceSpec.scala index 0bc7062e..0ddad1ee 100644 --- a/src/test/scala/net/yoshinorin/qualtet/domains/feeds/FeedServiceSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/domains/feeds/FeedServiceSpec.scala @@ -10,10 +10,9 @@ import cats.effect.unsafe.implicits.global // testOnly net.yoshinorin.qualtet.domains.FeedServiceSpec class FeedServiceSpec extends AnyWordSpec with BeforeAndAfterAll { - val requestContents = makeRequestContents(30, "feeds") - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents = makeRequestContents(30, "feeds") createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/domains/search/SearchServiceSpec.scala b/src/test/scala/net/yoshinorin/qualtet/domains/search/SearchServiceSpec.scala index ac90b84a..8de10630 100644 --- a/src/test/scala/net/yoshinorin/qualtet/domains/search/SearchServiceSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/domains/search/SearchServiceSpec.scala @@ -13,70 +13,69 @@ import cats.effect.unsafe.implicits.global // testOnly net.yoshinorin.qualtet.domains.search.SearchServiceSpec class SearchServiceSpec extends AnyWordSpec with BeforeAndAfterAll { - val requestContents: List[RequestContent] = { - (0 until 49).toList - .map(_.toString()) - .map(i => - RequestContent( - contentType = "article", - path = Path(s"/test/searchService-${i}"), - title = s"this is a searchService title ${i}", - rawContent = s"this is a searchService raw content ${i}", - htmlContent = s"this is a searchService html content ${i}", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"searchService${i}"), - externalResources = List() - ) - ) :+ RequestContent( - contentType = "article", - path = Path(s"/test/searchServiceLast"), - title = s"this is a searchService titleLast", - rawContent = s"this is a searchService raw contentLast", - htmlContent = s"this is a searchService html contentLast", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"searchServiceLast"), - externalResources = List() - ) :+ RequestContent( - contentType = "article", - path = Path(s"/test/searchServiceIncludesUrl1"), - title = s"this is a searchService IncludesUrl1", - rawContent = s"this is a searchService raw contentIncludesUrl1 https://example.com aaabbbccc", - htmlContent = s"this is a searchService html contentIncludesUrl1 https://example.com aaabbbccc", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"IncludesUrl1"), - externalResources = List() - ) :+ RequestContent( - contentType = "article", - path = Path(s"/test/searchServiceIncludesUrl2"), - title = s"this is a searchService IncludesUrl2", - rawContent = s"this is a searchService raw contentIncludesUrl2 http://example.com aaabbbccc", - htmlContent = s"this is a searchService html contentIncludesUrl2 http://example.com aaabbbccc", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"IncludesUrl2"), - externalResources = List() - ) :+ RequestContent( - contentType = "article", - path = Path(s"/test/searchServiceIncludesWrongUrl"), - title = s"this is a searchService IncludesWrongUrl1", - rawContent = s"this is a searchService raw contentIncludesWrongUrl1 htt://example.com aaabbbccc", - htmlContent = s"this is a searchService html contentIncludesWrongUrl1 htt://example.com aaabbbccc", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"IncludesWrongUrl1"), - externalResources = List() - ) :+ RequestContent( - contentType = "article", - path = Path(s"/test/searchServiceIncludesHttpString"), - title = s"this is a searchService IncludesHttpString", - rawContent = s"this is a searchService raw contentIncludesHttp String http://example.com aaabbbccc http", - htmlContent = s"this is a searchService html contentIncludesHttp String http://example.com aaabbbccc http", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"IncludesHttpString"), - externalResources = List() - ) - } - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents: List[RequestContent] = { + (0 until 49).toList + .map(_.toString()) + .map(i => + RequestContent( + contentType = "article", + path = Path(s"/test/searchService-${i}"), + title = s"this is a searchService title ${i}", + rawContent = s"this is a searchService raw content ${i}", + htmlContent = s"this is a searchService html content ${i}", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"searchService${i}"), + externalResources = List() + ) + ) :+ RequestContent( + contentType = "article", + path = Path(s"/test/searchServiceLast"), + title = s"this is a searchService titleLast", + rawContent = s"this is a searchService raw contentLast", + htmlContent = s"this is a searchService html contentLast", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"searchServiceLast"), + externalResources = List() + ) :+ RequestContent( + contentType = "article", + path = Path(s"/test/searchServiceIncludesUrl1"), + title = s"this is a searchService IncludesUrl1", + rawContent = s"this is a searchService raw contentIncludesUrl1 https://example.com aaabbbccc", + htmlContent = s"this is a searchService html contentIncludesUrl1 https://example.com aaabbbccc", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"IncludesUrl1"), + externalResources = List() + ) :+ RequestContent( + contentType = "article", + path = Path(s"/test/searchServiceIncludesUrl2"), + title = s"this is a searchService IncludesUrl2", + rawContent = s"this is a searchService raw contentIncludesUrl2 http://example.com aaabbbccc", + htmlContent = s"this is a searchService html contentIncludesUrl2 http://example.com aaabbbccc", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"IncludesUrl2"), + externalResources = List() + ) :+ RequestContent( + contentType = "article", + path = Path(s"/test/searchServiceIncludesWrongUrl"), + title = s"this is a searchService IncludesWrongUrl1", + rawContent = s"this is a searchService raw contentIncludesWrongUrl1 htt://example.com aaabbbccc", + htmlContent = s"this is a searchService html contentIncludesWrongUrl1 htt://example.com aaabbbccc", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"IncludesWrongUrl1"), + externalResources = List() + ) :+ RequestContent( + contentType = "article", + path = Path(s"/test/searchServiceIncludesHttpString"), + title = s"this is a searchService IncludesHttpString", + rawContent = s"this is a searchService raw contentIncludesHttp String http://example.com aaabbbccc http", + htmlContent = s"this is a searchService html contentIncludesHttp String http://example.com aaabbbccc http", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"IncludesHttpString"), + externalResources = List() + ) + } createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/domains/series/SeriesServiceSpec.scala b/src/test/scala/net/yoshinorin/qualtet/domains/series/SeriesServiceSpec.scala index 69b2217e..1fc72e99 100644 --- a/src/test/scala/net/yoshinorin/qualtet/domains/series/SeriesServiceSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/domains/series/SeriesServiceSpec.scala @@ -11,23 +11,22 @@ import cats.effect.unsafe.implicits.global // testOnly net.yoshinorin.qualtet.domains.SeriesServiceSpec class SeriesServiceSpec extends AnyWordSpec with BeforeAndAfterAll { - val requestSeries: List[RequestSeries] = List( - RequestSeries( - title = "Series Service Spec", - name = SeriesName("seriesservice-series"), - None - ), - RequestSeries( - title = "Series Service Spec2", - name = SeriesName("seriesservice-series2"), - None - ) - ) - - val requestContents = makeRequestContents(5, "SeriesService", Some(requestSeries.head.name)) - override protected def beforeAll(): Unit = { + val requestSeries: List[RequestSeries] = List( + RequestSeries( + title = "Series Service Spec", + name = SeriesName("seriesservice-series"), + None + ), + RequestSeries( + title = "Series Service Spec2", + name = SeriesName("seriesservice-series2"), + None + ) + ) createSeries(requestSeries) + + val requestContents = makeRequestContents(5, "SeriesService", Some(requestSeries.head.name)) createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/domains/tags/TagServiceSpec.scala b/src/test/scala/net/yoshinorin/qualtet/domains/tags/TagServiceSpec.scala index 3a5a802f..020db379 100644 --- a/src/test/scala/net/yoshinorin/qualtet/domains/tags/TagServiceSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/domains/tags/TagServiceSpec.scala @@ -14,10 +14,9 @@ class TagServiceSpec extends AnyWordSpec with BeforeAndAfterAll { given doobieExecuterContext: DoobieExecuter = new DoobieExecuter(fixtureTx) - val requestContents = makeRequestContents(10, "tagService") - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents = makeRequestContents(10, "tagService") createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/FeedRouteSpec.scala b/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/FeedRouteSpec.scala index bed88d18..13016ebc 100644 --- a/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/FeedRouteSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/FeedRouteSpec.scala @@ -16,10 +16,9 @@ import cats.effect.unsafe.implicits.global // testOnly net.yoshinorin.qualtet.http.routes.v1.FeedRouteSpec class FeedRouteV1Spec extends AnyWordSpec with BeforeAndAfterAll { - val requestContents = makeRequestContents(2, "feedsRoute") - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents = makeRequestContents(2, "feedsRoute") createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/SearchRouteSpec.scala b/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/SearchRouteSpec.scala index f243de8e..4d028944 100644 --- a/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/SearchRouteSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/SearchRouteSpec.scala @@ -19,34 +19,34 @@ import cats.effect.unsafe.implicits.global // testOnly net.yoshinorin.qualtet.http.routes.v1.SearchRouteV1Spec class SearchRouteV1Spec extends AnyWordSpec with BeforeAndAfterAll { - val requestContents: List[RequestContent] = { - (0 until 49).toList - .map(_.toString()) - .map(i => - RequestContent( - contentType = "article", - path = Path(s"/test/searchRoute-${i}"), - title = s"this is a searchRoute title ${i}", - rawContent = s"this is a searchRoute raw content ${i}", - htmlContent = s"this is a searchRoute html content ${i}", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"searchRoute${i}"), - externalResources = List() - ) - ) :+ RequestContent( - contentType = "article", - path = Path(s"/test/searchServiceLast"), - title = s"this is a searchService titleLast", - rawContent = s"this is a searchService raw contentLast", - htmlContent = s"this is a searchService html contentLast", - robotsAttributes = Attributes("noarchive, noimageindex"), - tags = List(s"searchServiceLast"), - externalResources = List() - ) - } - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents: List[RequestContent] = { + (0 until 49).toList + .map(_.toString()) + .map(i => + RequestContent( + contentType = "article", + path = Path(s"/test/searchRoute-${i}"), + title = s"this is a searchRoute title ${i}", + rawContent = s"this is a searchRoute raw content ${i}", + htmlContent = s"this is a searchRoute html content ${i}", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"searchRoute${i}"), + externalResources = List() + ) + ) :+ RequestContent( + contentType = "article", + path = Path(s"/test/searchServiceLast"), + title = s"this is a searchService titleLast", + rawContent = s"this is a searchService raw contentLast", + htmlContent = s"this is a searchService html contentLast", + robotsAttributes = Attributes("noarchive, noimageindex"), + tags = List(s"searchServiceLast"), + externalResources = List() + ) + } + createContents(requestContents) } diff --git a/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/SitemapRouteSpec.scala b/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/SitemapRouteSpec.scala index deb3bb2e..b8550324 100644 --- a/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/SitemapRouteSpec.scala +++ b/src/test/scala/net/yoshinorin/qualtet/http/routes/v1/SitemapRouteSpec.scala @@ -16,10 +16,9 @@ import cats.effect.unsafe.implicits.global // testOnly net.yoshinorin.qualtet.http.routes.v1.SitemapRouteSpec class SitemapRouteV1Spec extends AnyWordSpec with BeforeAndAfterAll { - val requestContents = makeRequestContents(2, "sitemapRoute") - override protected def beforeAll(): Unit = { // NOTE: create content and related data for test + val requestContents = makeRequestContents(2, "sitemapRoute") createContents(requestContents) }