فهرست منبع

test(acp-snapshot): cover the delta-insert trailing-newline branch

formatSystemPromptSnapshot's insert-join ternary had its already-newline-
terminated arm unexercised (a delta whose insert ends in a blank line),
failing the per-file 100% branch gate on suite.ts (99.24%).
Tianyi Cui 2 ماه پیش
والد
کامیت
bac97a5b2e
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      packages/support/acp-snapshot/tests/suite.spec.ts

+ 6 - 0
packages/support/acp-snapshot/tests/suite.spec.ts

@@ -273,6 +273,12 @@ describe('formatSystemPromptSnapshot', () => {
       { keepStart: 1, keepEnd: 0, insert: ['new', 'lines'] },
     ])).toBe('prompt\n\n<!-- request/header-delta 1: keepStart=1, keepEnd=0 -->\n\nnew\nlines\n')
   })
+
+  it('does not double the newline of a delta insert with a trailing blank line', () => {
+    expect(formatSystemPromptSnapshot('prompt\n', [
+      { keepStart: 2, keepEnd: 1, insert: ['tail', ''] },
+    ])).toBe('prompt\n\n<!-- request/header-delta 1: keepStart=2, keepEnd=1 -->\n\ntail\n')
+  })
 })
 
 describe('headerDeltaCount', () => {