@@ -41,10 +41,10 @@ async function extractedDocuments(path: string): Promise<string[]> {
4141 ) ;
4242}
4343
44- function docx ( text : string ) : Uint8Array {
44+ function docx ( text : string , secondLine ?: string ) : Uint8Array {
4545 return zipSync ( {
4646 "word/document.xml" : strToU8 (
47- `<?xml version="1.0"?><w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body><w:p><w:r><w:t>${ text } </w:t></w:r></w:p></w:body></w:document>` ,
47+ `<?xml version="1.0"?><w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body><w:p><w:r><w:t>${ text } </w:t></w:r>${ secondLine === undefined ? "" : `<w:br/><w:r><w:t> ${ secondLine } </w:t></w:r>` } </w:p></w:body></w:document>` ,
4848 ) ,
4949 } ) ;
5050}
@@ -111,14 +111,17 @@ describe("scan knowledge bases", () => {
111111 join ( root , "architecture.pdf" ) ,
112112 pdf ( "Payment service boundary" ) ,
113113 ) ;
114- await writeFile ( join ( root , "threat-model.docx" ) , docx ( "SSRF & IDOR" ) ) ;
114+ await writeFile (
115+ join ( root , "threat-model.docx" ) ,
116+ docx ( "SSRF & IDOR" , "Review authentication" ) ,
117+ ) ;
115118
116119 const knowledgeBase = await prepareKnowledgeBase ( [ root ] ) ;
117120 temporaryDirectories . push ( knowledgeBase . path ) ;
118121 const documents = await extractedDocuments ( knowledgeBase . path ) ;
119122
120123 expect ( documents ) . toContain ( "Payment service boundary" ) ;
121- expect ( documents ) . toContain ( "SSRF & IDOR\n" ) ;
124+ expect ( documents ) . toContain ( "SSRF & IDOR\nReview authentication\ n" ) ;
122125 } ) ;
123126
124127 test ( "cleans up documents and rediscovers directory contents on later runs" , async ( ) => {
0 commit comments