Skip to content
Permalink
Browse files

Add discipline-scalatest and bump ScalaTest version

  • Loading branch information...
fthomas committed Sep 10, 2019
1 parent 9bb7e99 commit 686d4628ce645447724884845c85e629e9d82508
Showing with 149 additions and 112 deletions.
  1. +1 −0 build.sbt
  2. +3 −2 modules/core/src/test/scala/org/scalasteward/core/application/CliTest.scala
  3. +5 −5 modules/core/src/test/scala/org/scalasteward/core/bitbucket/http4s/Http4sBitbucketApiAlgTest.scala
  4. +3 −2 modules/core/src/test/scala/org/scalasteward/core/bitbucket/http4s/JsonCodecTest.scala
  5. +3 −2 modules/core/src/test/scala/org/scalasteward/core/coursier/CoursierAlgTest.scala
  6. +4 −3 modules/core/src/test/scala/org/scalasteward/core/data/ExampleTest.scala
  7. +3 −2 modules/core/src/test/scala/org/scalasteward/core/data/SemVerTest.scala
  8. +3 −2 modules/core/src/test/scala/org/scalasteward/core/data/UpdateTest.scala
  9. +3 −2 modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
  10. +4 −3 modules/core/src/test/scala/org/scalasteward/core/edit/EditAlgTest.scala
  11. +4 −3 modules/core/src/test/scala/org/scalasteward/core/edit/UpdateHeuristicTest.scala
  12. +3 −2 modules/core/src/test/scala/org/scalasteward/core/edit/editTest.scala
  13. +3 −2 modules/core/src/test/scala/org/scalasteward/core/git/GitAlgTest.scala
  14. +4 −3 modules/core/src/test/scala/org/scalasteward/core/github/GitHubRepoAlgTest.scala
  15. +3 −2 modules/core/src/test/scala/org/scalasteward/core/github/UrlTest.scala
  16. +4 −3 modules/core/src/test/scala/org/scalasteward/core/github/http4s/Http4sGitHubApiAlgTest.scala
  17. +3 −2 modules/core/src/test/scala/org/scalasteward/core/github/http4s/authenticationTest.scala
  18. +11 −13 modules/core/src/test/scala/org/scalasteward/core/gitlab/Http4sGitlabApiAlgTest.scala
  19. +3 −2 modules/core/src/test/scala/org/scalasteward/core/io/FileAlgTest.scala
  20. +3 −2 modules/core/src/test/scala/org/scalasteward/core/io/ProcessAlgTest.scala
  21. +3 −2 modules/core/src/test/scala/org/scalasteward/core/io/processTest.scala
  22. +5 −4 modules/core/src/test/scala/org/scalasteward/core/repoconfig/RepoConfigAlgTest.scala
  23. +3 −2 modules/core/src/test/scala/org/scalasteward/core/sbt/SbtAlgTest.scala
  24. +3 −2 modules/core/src/test/scala/org/scalasteward/core/sbt/data/ArtificialProjectTest.scala
  25. +3 −2 modules/core/src/test/scala/org/scalasteward/core/sbt/parserTest.scala
  26. +3 −2 modules/core/src/test/scala/org/scalasteward/core/scalafmt/ScalafmtAlgTest.scala
  27. +4 −3 modules/core/src/test/scala/org/scalasteward/core/update/FilterAlgTest.scala
  28. +3 −2 modules/core/src/test/scala/org/scalasteward/core/update/UpdateServiceTest.scala
  29. +3 −2 modules/core/src/test/scala/org/scalasteward/core/update/showTest.scala
  30. +2 −2 modules/core/src/test/scala/org/scalasteward/core/util/ChangeTest.scala
  31. +3 −2 modules/core/src/test/scala/org/scalasteward/core/util/dateTimeTest.scala
  32. +3 −2 modules/core/src/test/scala/org/scalasteward/core/util/loggerTest.scala
  33. +3 −2 modules/core/src/test/scala/org/scalasteward/core/util/stringTest.scala
  34. +3 −2 modules/core/src/test/scala/org/scalasteward/core/util/uriTest.scala
  35. +3 −2 modules/core/src/test/scala/org/scalasteward/core/util/utilTest.scala
  36. +3 −2 modules/core/src/test/scala/org/scalasteward/core/vcs/VCSExtraAlgTest.scala
  37. +5 −6 modules/core/src/test/scala/org/scalasteward/core/vcs/VCSPackageTest.scala
  38. +3 −2 modules/core/src/test/scala/org/scalasteward/core/vcs/data/BranchOutTest.scala
  39. +4 −3 modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala
  40. +3 −2 modules/core/src/test/scala/org/scalasteward/core/vcs/data/PullRequestOutTest.scala
  41. +3 −2 modules/core/src/test/scala/org/scalasteward/core/vcs/data/PullRequestStateTest.scala
  42. +3 −2 modules/core/src/test/scala/org/scalasteward/core/vcs/data/RepoOutTest.scala
  43. +3 −2 modules/core/src/test/scala/org/scalasteward/core/vcs/data/RepoTest.scala
  44. +2 −1 project/Dependencies.scala
@@ -48,6 +48,7 @@ lazy val core = myCrossProject("core")
Dependencies.logbackClassic % Runtime,
Dependencies.catsKernelLaws % Test,
Dependencies.circeLiteral % Test,
Dependencies.disciplineScalatest % Test,
Dependencies.http4sDsl % Test,
Dependencies.refinedScalacheck % Test,
Dependencies.scalacheck % Test,
@@ -3,10 +3,11 @@ package org.scalasteward.core.application
import cats.implicits._
import org.http4s.Http4sLiteralSyntax
import org.scalasteward.core.application.Cli.EnvVar
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite
import scala.concurrent.duration._

class CliTest extends FunSuite with Matchers {
class CliTest extends AnyFunSuite with Matchers {
type Result[A] = Either[Throwable, A]
val cli: Cli[Result] = new Cli[Result]

@@ -7,15 +7,15 @@ import org.http4s.circe._
import org.http4s.client.Client
import org.http4s.dsl.io._
import org.http4s.implicits._
import org.http4s.{HttpRoutes}
import org.scalasteward.core.git._
import org.scalasteward.core.git.Sha1.HexString
import org.scalasteward.core.git._
import org.scalasteward.core.mock.MockContext.config
import org.scalasteward.core.util.HttpJsonClient
import org.scalasteward.core.vcs.data._
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class Http4sBitbucketApiAlgTest extends FunSuite with Matchers {
class Http4sBitbucketApiAlgTest extends AnyFunSuite with Matchers {

private val routes: HttpRoutes[IO] = HttpRoutes.of[IO] {
case GET -> Root / "repositories" / "fthomas" / "base.g8" =>
@@ -202,7 +202,7 @@ class Http4sBitbucketApiAlgTest extends FunSuite with Matchers {

test("listPullRequests") {
val prs = bitbucketApiAlg.listPullRequests(repo, "master", master).unsafeRunSync()
prs should contain only pullRequest
(prs should contain).only(pullRequest)
}

}
@@ -1,10 +1,11 @@
package org.scalasteward.core.bitbucket.http4s

import io.circe.Json
import org.scalatest.{FunSuite, Matchers}
import org.scalasteward.core.vcs.data.PullRequestState
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class JsonCodecTest extends FunSuite with Matchers {
class JsonCodecTest extends AnyFunSuite with Matchers {

test("PullRequestStatus decoding of expected values") {

@@ -3,9 +3,10 @@ package org.scalasteward.core.coursier
import org.scalasteward.core.data.Dependency
import org.scalasteward.core.mock.MockContext._
import org.scalasteward.core.mock.MockState
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class CoursierAlgTest extends FunSuite with Matchers {
class CoursierAlgTest extends AnyFunSuite with Matchers {

test("getArtifactUrl") {
val dep = Dependency("org.typelevel", "cats-effect", "cats-effect_2.12", "1.0.0")
@@ -1,11 +1,12 @@
package org.scalasteward.core.data

import org.scalasteward.core.edit.UpdateHeuristicTest.UpdateOps
import org.scalasteward.core.data.Update.Single
import org.scalasteward.core.edit.UpdateHeuristicTest.UpdateOps
import org.scalasteward.core.util.Nel
import org.scalatest.{Matchers, WordSpec}
import org.scalatest.Matchers
import org.scalatest.wordspec.AnyWordSpec

class ExampleTest extends WordSpec with Matchers {
class ExampleTest extends AnyWordSpec with Matchers {

"Good examples of dependency definitions".which {
"will be identified by scala-steward without any problems are".that {
@@ -3,9 +3,10 @@ package org.scalasteward.core.data
import eu.timepit.refined.types.numeric.NonNegBigInt
import eu.timepit.refined.types.string.NonEmptyString
import org.scalasteward.core.data.SemVer.Change
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class SemVerTest extends FunSuite with Matchers {
class SemVerTest extends AnyFunSuite with Matchers {
implicit val toNonNegBigInt: Int => NonNegBigInt =
i => NonNegBigInt.unsafeFrom(BigInt(i))

@@ -2,9 +2,10 @@ package org.scalasteward.core.data

import org.scalasteward.core.data.Update.{Group, Single}
import org.scalasteward.core.util.Nel
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class UpdateTest extends FunSuite with Matchers {
class UpdateTest extends AnyFunSuite with Matchers {

test("Group.artifactId") {
Group(
@@ -4,11 +4,12 @@ import cats.implicits._
import cats.kernel.Comparison.{EqualTo, GreaterThan, LessThan}
import cats.kernel.laws.discipline.OrderTests
import org.scalasteward.core.TestInstances._
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.prop.TableDrivenPropertyChecks._
import org.scalatest.{FunSuite, Matchers}
import org.typelevel.discipline.scalatest.Discipline

class VersionTest extends FunSuite with Discipline with Matchers {
class VersionTest extends AnyFunSuite with Discipline with Matchers {
checkAll("Order[Version]", OrderTests[Version].order)

test("comparison") {
@@ -1,14 +1,15 @@
package org.scalasteward.core.edit

import better.files.File
import org.scalasteward.core.data.Update
import org.scalasteward.core.mock.MockContext.editAlg
import org.scalasteward.core.mock.MockState
import org.scalasteward.core.data.Update
import org.scalasteward.core.util.Nel
import org.scalasteward.core.vcs.data.Repo
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class EditAlgTest extends FunSuite with Matchers {
class EditAlgTest extends AnyFunSuite with Matchers {

test("applyUpdate") {
val repo = Repo("fthomas", "scala-steward")
@@ -1,12 +1,13 @@
package org.scalasteward.core.edit

import org.scalasteward.core.edit.UpdateHeuristicTest.UpdateOps
import org.scalasteward.core.data.Update
import org.scalasteward.core.data.Update.{Group, Single}
import org.scalasteward.core.edit.UpdateHeuristicTest.UpdateOps
import org.scalasteward.core.util.Nel
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class UpdateHeuristicTest extends FunSuite with Matchers {
class UpdateHeuristicTest extends AnyFunSuite with Matchers {

test("sbt: build.properties") {
val original = """sbt.version=1.3.0-RC1"""
@@ -2,10 +2,11 @@ package org.scalasteward.core.edit

import cats.implicits._
import org.scalacheck.{Arbitrary, Gen}
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks

class editTest extends FunSuite with Matchers with ScalaCheckPropertyChecks {
class editTest extends AnyFunSuite with Matchers with ScalaCheckPropertyChecks {
private val lineGen = Gen.frequency(
3 -> Arbitrary.arbString.arbitrary,
1 -> Gen.oneOf("scala-steward:off", "scala-steward:on"),
@@ -13,9 +13,10 @@ import org.scalasteward.core.mock.MockContext._
import org.scalasteward.core.mock.MockState
import org.scalasteward.core.util.Nel
import org.scalasteward.core.vcs.data.Repo
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class GitAlgTest extends FunSuite with Matchers {
class GitAlgTest extends AnyFunSuite with Matchers {
implicit val workspaceAlg: WorkspaceAlg[IO] = WorkspaceAlg.create[IO]
val ioGitAlg: GitAlg[IO] = GitAlg.create[IO]

@@ -2,13 +2,14 @@ package org.scalasteward.core.github

import org.http4s.Http4sLiteralSyntax
import org.scalasteward.core.git.Branch
import org.scalasteward.core.vcs.data.{Repo, RepoOut, UserOut}
import org.scalasteward.core.mock.MockContext.{config, gitAlg, gitHubRepoAlg}
import org.scalasteward.core.mock.{MockContext, MockState}
import org.scalasteward.core.vcs.VCSRepoAlg
import org.scalatest.{FunSuite, Matchers}
import org.scalasteward.core.vcs.data.{Repo, RepoOut, UserOut}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class GitHubRepoAlgTest extends FunSuite with Matchers {
class GitHubRepoAlgTest extends AnyFunSuite with Matchers {
val repo = Repo("fthomas", "datapackage")
val repoDir: String = (config.workspace / "fthomas/datapackage").toString
val askPass = s"GIT_ASKPASS=${config.gitAskPass}"
@@ -3,9 +3,10 @@ package org.scalasteward.core.github
import org.http4s.Http4sLiteralSyntax
import org.scalasteward.core.git.Branch
import org.scalasteward.core.vcs.data.Repo
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class UrlTest extends FunSuite with Matchers {
class UrlTest extends AnyFunSuite with Matchers {
val url = new Url(uri"https://api.github.com")
import url._

@@ -9,12 +9,13 @@ import org.http4s.implicits._
import org.http4s.{Http4sLiteralSyntax, HttpRoutes}
import org.scalasteward.core.git.Sha1.HexString
import org.scalasteward.core.git.{Branch, Sha1}
import org.scalasteward.core.vcs.data._
import org.scalasteward.core.mock.MockContext.config
import org.scalasteward.core.util.HttpJsonClient
import org.scalatest.{FunSuite, Matchers}
import org.scalasteward.core.vcs.data._
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class Http4sGitHubApiAlgTest extends FunSuite with Matchers {
class Http4sGitHubApiAlgTest extends AnyFunSuite with Matchers {

val routes: HttpRoutes[IO] =
HttpRoutes.of[IO] {
@@ -4,9 +4,10 @@ import cats.Id
import org.http4s.headers.{Accept, Authorization}
import org.http4s.{BasicCredentials, Headers, MediaType, Request}
import org.scalasteward.core.vcs.data.AuthenticatedUser
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class authenticationTest extends FunSuite with Matchers {
class authenticationTest extends AnyFunSuite with Matchers {
test("addCredentials") {
val request = authentication
.addCredentials(AuthenticatedUser("user", "pass"))
@@ -1,26 +1,24 @@
package org.scalasteward.core.gitlab.http4s

import cats.effect.IO
import io.circe.parser._
import io.circe.literal._
import org.scalatest.{FunSuite, Matchers}
import org.scalasteward.core.vcs.data._
import org.scalasteward.core.nurture.UpdateData
import org.scalasteward.core.repoconfig.RepoConfig
import org.scalasteward.core.data.Update
import org.scalasteward.core.git.Sha1
import org.scalasteward.core.vcs.data.NewPullRequestData
import org.scalasteward.core.git.Branch
import org.scalasteward.core.util.Nel
import org.scalasteward.core.util.HttpJsonClient
import org.scalasteward.core.mock.MockContext.{config, user}
import io.circe.parser._
import org.http4s.circe._
import org.http4s.client.Client
import org.http4s.dsl.io._
import org.http4s.implicits._
import org.http4s.{Http4sLiteralSyntax, HttpRoutes}
import org.scalasteward.core.data.Update
import org.scalasteward.core.git.{Branch, Sha1}
import org.scalasteward.core.mock.MockContext.{config, user}
import org.scalasteward.core.nurture.UpdateData
import org.scalasteward.core.repoconfig.RepoConfig
import org.scalasteward.core.util.{HttpJsonClient, Nel}
import org.scalasteward.core.vcs.data.{NewPullRequestData, _}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class Http4sGitlabApiAlgTest extends FunSuite with Matchers {
class Http4sGitlabApiAlgTest extends AnyFunSuite with Matchers {
import GitlabJsonCodec._

val routes: HttpRoutes[IO] =
@@ -8,9 +8,10 @@ import org.scalasteward.core.TestInstances.ioLogger
import org.scalasteward.core.io.FileAlgTest.ioFileAlg
import org.scalasteward.core.mock.MockContext.fileAlg
import org.scalasteward.core.mock.MockState
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class FileAlgTest extends FunSuite with Matchers {
class FileAlgTest extends AnyFunSuite with Matchers {
test("createTemporarily") {
val file = File.temp / "test-scala-steward3.tmp"
val content = Arbitrary.arbitrary[String].sample.getOrElse("")
@@ -7,9 +7,10 @@ import org.scalasteward.core.io.ProcessAlgTest.ioProcessAlg
import org.scalasteward.core.mock.MockContext._
import org.scalasteward.core.mock.MockState
import org.scalasteward.core.util.Nel
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class ProcessAlgTest extends FunSuite with Matchers {
class ProcessAlgTest extends AnyFunSuite with Matchers {
test("exec echo") {
ioProcessAlg
.exec(Nel.of("echo", "-n", "hello"), File.currentWorkingDirectory)
@@ -3,10 +3,11 @@ package org.scalasteward.core.io
import cats.effect.IO
import org.scalasteward.core.TestInstances._
import org.scalasteward.core.util.Nel
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite
import scala.concurrent.duration._

class processTest extends FunSuite with Matchers {
class processTest extends AnyFunSuite with Matchers {
def slurp1(cmd: Nel[String]): IO[List[String]] =
process.slurp[IO](cmd, None, Map.empty, 1.minute, _ => IO.unit)

@@ -1,14 +1,15 @@
package org.scalasteward.core.repoconfig

import better.files.File
import org.scalasteward.core.vcs.data.Repo
import org.scalasteward.core.data.Update
import org.scalasteward.core.mock.MockContext.repoConfigAlg
import org.scalasteward.core.mock.MockState
import org.scalasteward.core.data.Update
import org.scalasteward.core.util.Nel
import org.scalatest.{FunSuite, Matchers}
import org.scalasteward.core.vcs.data.Repo
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class RepoConfigAlgTest extends FunSuite with Matchers {
class RepoConfigAlgTest extends AnyFunSuite with Matchers {
test("config with all fields set") {
val repo = Repo("fthomas", "scala-steward")
val configFile = File.temp / "ws/fthomas/scala-steward/.scala-steward.conf"
@@ -8,9 +8,10 @@ import org.scalasteward.core.mock.{MockContext, MockState}
import org.scalasteward.core.scalafix.Migration
import org.scalasteward.core.util.Nel
import org.scalasteward.core.vcs.data.Repo
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class SbtAlgTest extends FunSuite with Matchers {
class SbtAlgTest extends AnyFunSuite with Matchers {

test("addGlobalPlugins") {
sbtAlg.addGlobalPlugins.runS(MockState.empty).unsafeRunSync() shouldBe MockState.empty.copy(
@@ -1,9 +1,10 @@
package org.scalasteward.core.sbt.data

import org.scalasteward.core.data.Dependency
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class ArtificialProjectTest extends FunSuite with Matchers {
class ArtificialProjectTest extends AnyFunSuite with Matchers {
val catsEffect =
Dependency("org.typelevel", "cats-effect", "cats-effect_2.12", "1.0.0", None)
val scalaLibrary =
@@ -4,9 +4,10 @@ import org.scalasteward.core.data.{Dependency, Update}
import org.scalasteward.core.sbt.data.SbtVersion
import org.scalasteward.core.sbt.parser._
import org.scalasteward.core.util.Nel
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.Matchers
import org.scalatest.funsuite.AnyFunSuite

class parserTest extends FunSuite with Matchers {
class parserTest extends AnyFunSuite with Matchers {
test("parseBuildProperties: with whitespace") {
parseBuildProperties("sbt.version = 1.2.8") shouldBe Some(SbtVersion("1.2.8"))
}

0 comments on commit 686d462

Please sign in to comment.
You can’t perform that action at this time.