Skip to content

Commit

Permalink
use lowercase for device fields and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fcs-ts committed Aug 13, 2024
1 parent cbbd05b commit ec95e04
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sealed class BannerConfig private constructor() {
data class LandingPage(
val slotId: String,
val ids: List<String>,
val device: Device = Device.MOBILE,
val device: Device = Device.mobile,
val geoTargeting: String? = null
) : BannerConfig()

Expand All @@ -33,7 +33,7 @@ sealed class BannerConfig private constructor() {
data class CategorySingle(
val slotId: String,
val category: String,
val device: Device = Device.MOBILE,
val device: Device = Device.mobile,
val geoTargeting: String? = null
) : BannerConfig()

Expand All @@ -48,7 +48,7 @@ sealed class BannerConfig private constructor() {
data class CategoryMultiple(
val slotId: String,
val categories: List<String>,
val device: Device = Device.MOBILE,
val device: Device = Device.mobile,
val geoTargeting: String? = null,
) : BannerConfig()

Expand All @@ -63,7 +63,7 @@ sealed class BannerConfig private constructor() {
data class CategoryDisjunctions(
val slotId: String,
val disjunctions: List<List<String>>,
val device: Device = Device.MOBILE,
val device: Device = Device.mobile,
val geoTargeting: String? = null,
) : BannerConfig()

Expand All @@ -78,7 +78,7 @@ sealed class BannerConfig private constructor() {
data class Keyword(
val slotId: String,
val keyword: String,
val device: Device = Device.MOBILE,
val device: Device = Device.mobile,
val geoTargeting: String? = null,
) : BannerConfig()
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ data class Auction private constructor(
slots: Int,
slotId: String,
ids: List<String>,
device: Device = Device.MOBILE,
device: Device = Device.mobile,
geoTargeting: String? = null,
): Auction {
return Auction(
Expand All @@ -106,7 +106,7 @@ data class Auction private constructor(
slots: Int,
slotId: String,
category: String,
device: Device = Device.MOBILE,
device: Device = Device.mobile,
geoTargeting: String? = null,
): Auction {
return Auction(
Expand All @@ -124,7 +124,7 @@ data class Auction private constructor(
slots: Int,
slotId: String,
categories: List<String>,
device: Device = Device.MOBILE,
device: Device = Device.mobile,
geoTargeting: String? = null,
): Auction {
return Auction(
Expand All @@ -142,7 +142,7 @@ data class Auction private constructor(
slots: Int,
slotId: String,
disjunctions: List<List<String>>,
device: Device = Device.MOBILE,
device: Device = Device.mobile,
geoTargeting: String? = null,
): Auction {
return Auction(
Expand All @@ -160,7 +160,7 @@ data class Auction private constructor(
slots: Int,
slotId: String,
keyword: String,
device: Device = Device.MOBILE,
device: Device = Device.mobile,
geoTargeting: String? = null,
): Auction {
return Auction(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.topsort.analytics.model.auctions

@Suppress("EnumNaming")
enum class Device {
DESKTOP,
MOBILE
desktop,
mobile
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class RunTest {
val bannerAuction = buildBannerAuction(bannerConfig);
val json = JSONObject.wrap(bannerAuction)!!.toString()
val expectedJson =
"{\"slots\":1,\"slotId\":\"$slot\",\"category\":{\"id\":\"$category\"},\"type\":\"banners\",\"device\":\"mobile\"}}"
"{\"slots\":1,\"slotId\":\"$slot\",\"category\":{\"id\":\"$category\"},\"type\":\"banners\",\"device\":\"mobile\"}"
assertThat(json).isEqualTo(expectedJson)
}

Expand All @@ -37,7 +37,7 @@ internal class RunTest {
val bannerAuction = buildBannerAuction(bannerConfig);
val json = JSONObject.wrap(bannerAuction)!!.toString()
val expectedJson =
"{\"slots\":1,\"slotId\":\"$slot\",\"category\":{\"ids\":[\"${categories[0]}\",\"${categories[1]}\"]},\"type\":\"banners\",\"device\":\"mobile\"}}"
"{\"slots\":1,\"slotId\":\"$slot\",\"category\":{\"ids\":[\"${categories[0]}\",\"${categories[1]}\"]},\"type\":\"banners\",\"device\":\"mobile\"}"
assertThat(json).isEqualTo(expectedJson)
}

Expand All @@ -50,7 +50,7 @@ internal class RunTest {
val bannerAuction = buildBannerAuction(bannerConfig);
val json = JSONObject.wrap(bannerAuction)!!.toString()
val expectedJson =
"{\"slots\":1,\"slotId\":\"$slot\",\"category\":{\"disjunctions\":[[\"${disjunctions[0][0]}\",\"${disjunctions[0][1]}\"],[\"${disjunctions[1][0]}\"]]},\"type\":\"banners\",\"device\":\"mobile\"}}"
"{\"slots\":1,\"slotId\":\"$slot\",\"category\":{\"disjunctions\":[[\"${disjunctions[0][0]}\",\"${disjunctions[0][1]}\"],[\"${disjunctions[1][0]}\"]]},\"type\":\"banners\",\"device\":\"mobile\"}"
assertThat(json).isEqualTo(expectedJson)
}
}

0 comments on commit ec95e04

Please sign in to comment.