Files
Enterprise-Knowledge-Base/frontend/src/utils/knowledgeChunksDisplay.test.mjs
T
wizardchen c6f1b54f73 feat(chat): refactor agent stream display and tool result rendering
Add RagPipelineProgress timeline, simplify AgentStreamDisplay structure,
group grep hits per document, and add KnowledgeChunksList tool result UI.
2026-06-16 01:21:19 +08:00

27 lines
791 B
JavaScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { getKnowledgeChunksSummaryHtml } from './knowledgeChunksDisplay.ts'
const t = (key, params) => {
if (key === 'agentStream.knowledgeChunksList.chunkRange') {
return `loaded ${params?.fetched}/${params?.total}`
}
if (key === 'agentStream.knowledgeChunksList.page') {
return `page ${params?.page}/${params?.pageSize}`
}
return key
}
test('getKnowledgeChunksSummaryHtml joins chunk range and page', () => {
const html = getKnowledgeChunksSummaryHtml(t, {
display_type: 'knowledge_chunks_list',
fetched_chunks: 20,
total_chunks: 282,
page: 3,
page_size: 20,
})
assert.match(html, /loaded <strong>20<\/strong>\/<strong>282<\/strong>/)
assert.match(html, /page 3\/20/)
})