mirror of
https://github.com/stablyai/orca.git
synced 2026-10-13 08:02:52 +00:00
* fix(mobile-chat): a returned message is appended to the draft, and an expired resend id is spent * test(mobile-chat): leave the idempotent append to the shared rule's own test * docs(native-chat): say a whitespace-only draft counts as empty * docs(mobile-chat): don't overclaim where returned text survives
24 lines
986 B
TypeScript
24 lines
986 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { appendReturnedDraftText } from './returned-draft-text'
|
|
|
|
describe('appendReturnedDraftText', () => {
|
|
it('fills an empty composer with the returned text as it was typed', () => {
|
|
expect(appendReturnedDraftText('', 'ping ')).toBe('ping ')
|
|
expect(appendReturnedDraftText(' \n', 'ping')).toBe('ping')
|
|
})
|
|
|
|
it('puts the returned text after a draft, a blank line apart', () => {
|
|
expect(appendReturnedDraftText('newer edit\n', 'ping')).toBe('newer edit\n\nping')
|
|
})
|
|
|
|
it('adds nothing when the draft already ends with that text', () => {
|
|
expect(appendReturnedDraftText('ping', 'ping')).toBe('ping')
|
|
expect(appendReturnedDraftText('first\n\nping\n', 'ping ')).toBe('first\n\nping\n')
|
|
expect(appendReturnedDraftText('ping', '')).toBe('ping')
|
|
})
|
|
|
|
it('still appends text that only ends a line of the draft', () => {
|
|
expect(appendReturnedDraftText('say ping', 'ping')).toBe('say ping\n\nping')
|
|
})
|
|
})
|