Skip to content

Commit c8cd67d

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
test(knowledge): focus create document coverage
1 parent dd64109 commit c8cd67d

1 file changed

Lines changed: 2 additions & 29 deletions

File tree

apps/sim/tools/knowledge/knowledge.test.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -184,43 +184,16 @@ describe('Knowledge Tools', () => {
184184
expect(result.output.data.documentId).toBe('legacy-doc-123')
185185
})
186186

187-
it.each([
188-
['missing documentsCreated', { data: {} }],
189-
['null documentsCreated', { data: { documentsCreated: null } }],
190-
['empty documentsCreated', { data: { documentsCreated: [] } }],
191-
['created document without an ID', { data: { documentsCreated: [{}] } }],
192-
])('preserves empty IDs for %s', async (_label, responseBody) => {
187+
it('preserves empty IDs when no documents are created', async () => {
193188
const result = await knowledgeCreateDocumentTool.transformResponse!(
194-
createMockResponse(responseBody)
189+
createMockResponse({ data: { documentsCreated: [] } })
195190
)
196191

197192
expect(result.success).toBe(true)
198193
expect(result.output.documentId).toBe('')
199194
expect(result.output.data.documentId).toBe('')
200195
})
201196
})
202-
203-
it.each([
204-
['omitted tags', {}],
205-
['an empty tag array', { documentTags: [] }],
206-
['a serialized empty tag array', { documentTags: '[]' }],
207-
])('omits tag data and tag provenance for %s', (_label, tagParams) => {
208-
const params = {
209-
knowledgeBaseId: 'kb-1',
210-
name: 'document.txt',
211-
content: 'document content',
212-
...tagParams,
213-
}
214-
const body = knowledgeCreateDocumentTool.operation.input(params) as {
215-
documents: Array<{ documentTagsData?: string }>
216-
}
217-
218-
expect(body.documents[0]).not.toHaveProperty('documentTagsData')
219-
expect(knowledgeCreateDocumentTool.operation.secretProvenance?.request?.(params)).toEqual([
220-
{ key: 'document-filename:0', inputPaths: [['name']] },
221-
{ key: 'document-content:0', inputPaths: [['content']] },
222-
])
223-
})
224197
})
225198

226199
describe('knowledgeSearchTool', () => {

0 commit comments

Comments
 (0)