Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kakao.actionbase.v2.engine.label

import com.kakao.actionbase.core.metadata.common.Cache
import com.kakao.actionbase.v2.core.metadata.Active
import com.kakao.actionbase.v2.core.types.DataType
import com.kakao.actionbase.v2.core.types.Field
Expand All @@ -12,7 +13,11 @@ import com.kakao.actionbase.v2.engine.sql.Row
import com.kakao.actionbase.v2.engine.sql.RowWithSchema
import com.kakao.actionbase.v2.engine.test.GraphFixtures

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper

import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain

class LabelEntitySpec :
StringSpec({
Expand Down Expand Up @@ -107,4 +112,19 @@ class LabelEntitySpec :

LabelEntity.toEntity(rowWithSchema)
}

"LabelEntity JSON serializes caches field" {
val entity =
Metadata.serviceLabelEntity.copy(
caches = listOf(Cache(cache = "c1", fields = emptyList())),
)

val json = jacksonObjectMapper().writeValueAsString(entity)
json shouldContain "\"caches\""
json shouldContain "\"c1\""

val roundTripped = jacksonObjectMapper().readValue(json, LabelEntity::class.java)
roundTripped.caches.size shouldBe 1
roundTripped.caches[0].cache shouldBe "c1"
}
})
Loading