v0.9.8: bubble for Android 0.7.8 — a text that doesn't go out is loud: closing mid-send asks first, sends stranded by a quit come back as Not sent, and failures pop up a notification, a red banner and a mark in the chat list
This commit is contained in:
@@ -203,6 +203,20 @@ describe('MessageDb', () => {
|
||||
expect(db.getMessage(t)?.error).toBe('nope')
|
||||
})
|
||||
|
||||
it('fails sends a previous run left pending, except over the SIM, and counts them per chat', () => {
|
||||
const t1 = db.insertPending({ did: '5550001111', contact: 'a', direction: 'out', body: 'stranded', ts: 1000 })
|
||||
const t2 = db.insertPending({ did: 'sim', contact: 'a', direction: 'out', body: 'waits for the Rabbit', ts: 1001 })
|
||||
const orphans = db.failOrphanedSends('closed mid-send')
|
||||
expect(orphans.map((m) => m.id)).toEqual([t1])
|
||||
expect(db.getMessage(t1)).toMatchObject({ status: 'failed', error: 'closed mid-send' })
|
||||
expect(db.getMessage(t2)?.status).toBe('pending')
|
||||
expect(db.listConversations().find((c) => c.did === '5550001111')?.failed).toBe(1)
|
||||
expect(db.listConversations().find((c) => c.did === 'sim')?.failed).toBe(0)
|
||||
// Still matched if it turns out it did go out.
|
||||
expect(db.reconcileSent([{ ...msg(50, 'a', 'stranded', 1000, 'out') }])).toEqual([t1])
|
||||
expect(db.listConversations().find((c) => c.did === '5550001111')?.failed).toBe(0)
|
||||
})
|
||||
|
||||
describe('reconcileSent', () => {
|
||||
const MIN = 60_000
|
||||
const pending = (body: string, ts: number): number => db.insertPending({ did: '5550001111', contact: 'a', direction: 'out', body, ts })
|
||||
|
||||
Reference in New Issue
Block a user