@@ -6,7 +6,7 @@ import io.kotest.matchers.shouldBe
6
6
import io.kotest.matchers.string.shouldContain
7
7
import io.kotest.matchers.string.shouldStartWith
8
8
9
- const val testJson = """
9
+ private fun testJson ( ext : String = "") = """
10
10
{
11
11
"type": "native",
12
12
"auction_id": "d07668d6-35ba-4870-a3cd-02b18fec1a12",
@@ -33,12 +33,13 @@ const val testJson = """
33
33
"win_response": "https://test.adsbynimbus.com/win_response/",
34
34
"loss_response": "https://test.adsbynimbus.com/loss_response/auctionPrice=[AUCTION_PRICE]&auctionMinToWin=[AUCTION_MIN_TO_WIN]&winningSource=[WINNING_SOURCE]"
35
35
}
36
+ $ext
36
37
}
37
38
"""
38
39
39
40
class DeserializationTest : StringSpec ({
40
41
41
- val response = BidResponse .fromJson(testJson)
42
+ val response = BidResponse .fromJson(testJson() )
42
43
43
44
" BidResponse fromJson deserializes the type field" {
44
45
response.type shouldBe " native"
@@ -104,6 +105,20 @@ class DeserializationTest : StringSpec({
104
105
response.win_response shouldBe " https://test.adsbynimbus.com/win_response/"
105
106
}
106
107
108
+ " BidResponse fromJson deserializes use_new_renderer" {
109
+ response.ext.use_new_renderer shouldBe false
110
+ BidResponse .fromJson(testJson("""
111
+ ,"ext": {
112
+ "use_new_renderer": true
113
+ }
114
+ """.trimIndent())).ext.use_new_renderer shouldBe true
115
+ BidResponse .fromJson(testJson("""
116
+ ,"ext": {
117
+ "use_new_renderer": false
118
+ }
119
+ """.trimIndent())).ext.use_new_renderer shouldBe false
120
+ }
121
+
107
122
" BidResponse fromJson deserializes loss urls" {
108
123
response.loss_response shouldStartWith " https://test.adsbynimbus.com/loss_response/"
109
124
response.loss_response shouldContain " auctionPrice=[AUCTION_PRICE]"
0 commit comments