diff --git a/scripts/test-ParsedValueView-strict.mjs b/scripts/test-ParsedValueView-strict.mjs index 32c6c14..4e5d1d2 100644 --- a/scripts/test-ParsedValueView-strict.mjs +++ b/scripts/test-ParsedValueView-strict.mjs @@ -40,4 +40,25 @@ for (const snippet of forbiddenCompatibilitySnippets) { ); } +const requiredStrictRenderingSnippets = [ + "LONG_TEXT_KEYS.sceneImage", + "LONG_TEXT_KEYS.commodityList", + "commodity.commodity_id", + "commodity.commodity_name", + "commodity.commodity_price", + "commodity.commodity_tag", + "commodity.commodity_photo", + "content-body-list-marker", + "entry.value.length > 1", + "formatListMarker(index)", +]; + +for (const snippet of requiredStrictRenderingSnippets) { + assert.equal( + source.includes(snippet), + true, + `ParsedValueView should render exact strict field: ${snippet}` + ); +} + console.log("ParsedValueView strict field checks passed"); diff --git a/scripts/test-longTextCard.mjs b/scripts/test-longTextCard.mjs index 9972902..c56d4dc 100644 --- a/scripts/test-longTextCard.mjs +++ b/scripts/test-longTextCard.mjs @@ -7,6 +7,8 @@ const moduleUrl = `data:text/javascript;base64,${Buffer.from(source).toString("b const longTextCard = await import(moduleUrl); const { + LONG_TEXT_FIELD_CONFIG, + LONG_TEXT_KEYS, parseLongTextDisplayValue, sanitizeLongTextDisplayValue, hasLongTextDisplayValue, @@ -51,4 +53,23 @@ assert.equal(hasLongTextDisplayValue({ a: "", b: [" ", null] }), false); assert.equal(formatLongTextDisplayValue(true), "\u662f"); assert.equal(formatLongTextDisplayValue({ title: "bridge" }), '{"title":"bridge"}'); +const expectedNewKeys = { + preparationSectionTitle: "preparation_section_title", + preparationSectionItems: "preparation_section_items", + sectionSuggestionTitle: "section_suggestion_title", + sectionSuggestionContent: "section_suggestion_content", + pitfallSectionTitle: "pitfall_section_title", + pitfallSectionItems: "pitfall_section_items", + commodityList: "commodity_list", +}; + +for (const [keyName, keyValue] of Object.entries(expectedNewKeys)) { + assert.equal(LONG_TEXT_KEYS[keyName], keyValue, `${keyName} should be registered`); + assert.equal( + LONG_TEXT_FIELD_CONFIG.some((item) => item.key === keyValue), + true, + `${keyValue} should be in LONG_TEXT_FIELD_CONFIG` + ); +} + console.log("longTextCard display helpers passed"); diff --git a/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue b/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue index aa0f706..529e667 100644 --- a/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue +++ b/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue @@ -1,6 +1,6 @@