fix: preserve complete weekly brief content and date bounds

This commit is contained in:
2026-09-06 14:29:59 +03:00
parent 23512b7a87
commit d3a52caf2b
8 changed files with 143 additions and 24 deletions
+21
View File
@@ -75,3 +75,24 @@ test('one recipient failure does not skip subsequent recipients; feed failure is
assert.deepEqual(f.calls,['email']);
await assert.rejects(f.send(async()=>{throw new Error('Feed unavailable');}),/Feed unavailable/);
});
test('long brief is sent completely as plain text with each part accounted for',async()=>{
const content=('Ürün <test> & 🧪\n').repeat(700),sent=[];
const f=fixture({text:()=>content,emailConfigured:()=>false,
sendTelegram:async(chatId,text,options)=>{sent.push(text);assert.deepEqual(options,{parseMode:null});return true;}});
const result=await f.send(async()=>[]);
assert.equal(sent.join(''),content);
assert.ok(sent.length>1);
assert.equal(result.kanallar.telegram.kabul,sent.length);
assert.equal(result.hata,0);
});
test('a failed Telegram part stops subsequent parts but still attempts email',async()=>{
let attempts=0;
const f=fixture({text:()=> 'x'.repeat(12000),sendTelegram:async()=>{attempts++;if(attempts===2)throw new Error('Unavailable');return true;}});
const result=await f.send(async()=>[]);
assert.equal(attempts,2);
assert.deepEqual(result.kanallar.telegram,{denenen:2,kabul:1,hata:1});
assert.equal(result.kanallar.email.kabul,1);
assert.equal(result.hata,1);
});