@@ -64,15 +64,21 @@ describe("cloud-prompt", () => {
6464 ) ;
6565 } ) ;
6666
67- it ( "strips the trailing attachment summary from a task description" , ( ) => {
68- expect (
69- stripTrailingAttachmentSummary ( "do this\n\nAttached files: a.png, b.txt" ) ,
70- ) . toBe ( "do this" ) ;
71- expect ( stripTrailingAttachmentSummary ( "Attached files: a.png" ) ) . toBe ( "" ) ;
72- expect ( stripTrailingAttachmentSummary ( "do this" ) ) . toBe ( "do this" ) ;
73- expect (
74- stripTrailingAttachmentSummary ( "Attached files: a.png\n\nthen do this" ) ,
75- ) . toBe ( "Attached files: a.png\n\nthen do this" ) ;
67+ it . each ( [
68+ [
69+ "text + trailing summary" ,
70+ "do this\n\nAttached files: a.png, b.txt" ,
71+ "do this" ,
72+ ] ,
73+ [ "summary only" , "Attached files: a.png" , "" ] ,
74+ [ "no summary" , "do this" , "do this" ] ,
75+ [
76+ "summary not at end" ,
77+ "Attached files: a.png\n\nthen do this" ,
78+ "Attached files: a.png\n\nthen do this" ,
79+ ] ,
80+ ] ) ( "stripTrailingAttachmentSummary: %s" , ( _label , input , expected ) => {
81+ expect ( stripTrailingAttachmentSummary ( input ) ) . toBe ( expected ) ;
7682 } ) ;
7783
7884 it ( "uses resource_link path references for text attachments" , async ( ) => {
0 commit comments