Skip to content

Commit

Permalink
tests: add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
daddykotex committed Dec 3, 2024
1 parent 251579f commit 5fe4dd9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,13 @@ lazy val courier = (project in file("courier"))
"org.jvnet.mock-javamail" % "mock-javamail" % "1.9" % Test
),
testFrameworks += new TestFramework("munit.Framework")
)
)
lazy val it = (project in file("integration-tests"))
.settings(commonSettings ++ cFlags)
.settings(
name := "courier-integration-tests",
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "0.7.27" % Test,
),
testFrameworks += new TestFramework("munit.Framework")
).dependsOn(courier)
23 changes: 23 additions & 0 deletions integration-tests/src/test/scala/mailspec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package courier

import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._


class MailSpec extends munit.FunSuite {
test("the mailer should send an email") {
assume(sys.env("CI").isEmpty(), "This test is meant to be ran locally.")
val email = sys.env("IT_EMAIL")
val password = sys.env("IT_PASSWORD")
val mailer = Mailer("smtp.gmail.com", 587)
.auth(true)
.as(email, password)
.startTls(true)()
val mId = Await.result(mailer(Envelope.from(email.addr)
.to(email.addr)
.subject("miss you")
.content(Text("hi mom"))), 10.seconds)
assert(mId.nonEmpty, "Message-ID should be set by the Transport.send call")
}
}

0 comments on commit 5fe4dd9

Please sign in to comment.