Skip to content

Commit 933a5df

Browse files
committed
Spec for calculateYear in ReportUtil
1 parent fa86dfb commit 933a5df

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

publication/src/test/scala/hmda/publication/reports/util/ReportUtilSpec.scala

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
package hmda.publication.reports.util
22

3+
import akka.actor.ActorSystem
4+
import akka.stream.ActorMaterializer
5+
import akka.stream.scaladsl.Source
6+
import hmda.model.fi.lar.LarGenerators
37
import hmda.model.publication.reports.MSAReport
48
import hmda.publication.reports.util.ReportUtil._
9+
import hmda.query.repository.filing.LarConverter._
510
import org.scalatest.{ AsyncWordSpec, MustMatchers }
611

7-
class ReportUtilSpec extends AsyncWordSpec with MustMatchers {
12+
class ReportUtilSpec extends AsyncWordSpec with MustMatchers with LarGenerators {
13+
14+
implicit val system = ActorSystem()
15+
implicit val ec = system.dispatcher
16+
implicit val materializer = ActorMaterializer()
817

918
"msaReport" must {
1019
"get MSA info for given fips code and return MSAReport object" in {
@@ -31,4 +40,15 @@ class ReportUtilSpec extends AsyncWordSpec with MustMatchers {
3140
}
3241
}
3342

43+
"calculateYear" must {
44+
"given a larSource, return the Activity Year for the LARs in it" in {
45+
// Activity Year is the same year as Action Taken Date. This is enforced by edit S270
46+
val lars = larListGen.sample.get.map(_.copy(actionTakenDate = 20090822))
47+
val src = Source.fromIterator(() => lars.toIterator)
48+
.map(lar => toLoanApplicationRegisterQuery(lar))
49+
50+
calculateYear(src).map(_ mustBe 2009)
51+
}
52+
}
53+
3454
}

0 commit comments

Comments
 (0)