Skip to content

Commit

Permalink
alerts-server: Fix non-deterministic test on DailyPriceAlertsControll…
Browse files Browse the repository at this point in the history
…erSpec
  • Loading branch information
AlexITC committed Jan 20, 2018
1 parent c3a2aa1 commit 4e2c417
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,17 @@ class DailyPriceAlertsControllerSpec extends PlayAPISpec {
val user = DataHelper.createVerifiedUser()
val token = jwtService.createToken(user)
val currencies = exchangeCurrencyDataHandler.getAll().get
DataHelper.createDailyPriceAlert(user.id, RandomDataGenerator.item(currencies).id)
DataHelper.createDailyPriceAlert(user.id, RandomDataGenerator.item(currencies).id)
val size = 2
RandomDataGenerator.uniqueItems(currencies, size).foreach { exchangeCurrency =>
val r = DataHelper.createDailyPriceAlert(user.id, exchangeCurrency.id)
r.isGood mustEqual true
}

val response = GET(url.withQueryParams(query), token.toHeader)
status(response) mustEqual OK

val json = contentAsJson(response)
(json \ "total").as[Int] mustEqual 2
(json \ "total").as[Int] mustEqual size
(json \ "offset").as[Int] mustEqual query.offset.int
(json \ "limit").as[Int] mustEqual query.limit.int

Expand Down

0 comments on commit 4e2c417

Please sign in to comment.