feat(t214): persist candidate observation identities
This commit is contained in:
+4
-3
@@ -150,13 +150,14 @@ class CandidateEvidenceSourceTest {
|
||||
)
|
||||
return PinduoduoCandidateEvidence(
|
||||
ordinal = ordinal,
|
||||
cardSignature = "card-$ordinal",
|
||||
cardSignature = PinduoduoEvidenceHash.sha256("card-$ordinal"),
|
||||
cardSemanticTextCount = 3,
|
||||
detailSignature = "detail-$ordinal",
|
||||
detailSignature = PinduoduoEvidenceHash.sha256("detail-$ordinal"),
|
||||
detailSemanticTextCount = 4,
|
||||
detailAsset = asset,
|
||||
specification = specification(),
|
||||
specificationAsset = asset.copy(fileName = specificationFileName)
|
||||
specificationAsset = asset.copy(fileName = specificationFileName),
|
||||
observedTitle = "候选商品标题 $ordinal"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.roubao.autopilot.pinduoduo
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class PinduoduoObservedTitlePolicyTest {
|
||||
@Test
|
||||
fun `selects longest product-like semantic text`() {
|
||||
val title = PinduoduoObservedTitlePolicy.select(
|
||||
listOf(
|
||||
"¥12.90",
|
||||
"店铺客服",
|
||||
"2026夏季纯棉宽松短袖圆领上衣",
|
||||
"纯棉短袖"
|
||||
)
|
||||
)
|
||||
|
||||
assertEquals("2026夏季纯棉宽松短袖圆领上衣", title)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `rejects actions prices and numeric-only text`() {
|
||||
val title = PinduoduoObservedTitlePolicy.select(
|
||||
listOf(
|
||||
"免拼购买",
|
||||
"已选择 黑色 L",
|
||||
"¥12.90",
|
||||
"123456"
|
||||
)
|
||||
)
|
||||
|
||||
assertNull(title)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user