import { describe, expect, it } from 'vitest' import { account, status } from '$test/fixtures' import { accountForStatus, isHelenepost } from './heleneposting' describe('Heleneposting detection', () => { it.each([ '

A note
-Helene

', '

A note

-- Helene

', '

A note —Helene

', '
A note

— Helene 

', '
@sun that is woke —helene
', ])('recognizes a signed HTML note: %s', (content) => { expect(isHelenepost(content)).toBe(true) }) it.each([ '

Helene

', '

---Helene

', '

—Helene!

', '

—Helene wrote this

', '

—helen

', ])('rejects content that is not an exact final signature: %s', (content) => { expect(isHelenepost(content)).toBe(false) }) it('substitutes presentation fields without changing account identity', () => { const original = account({ id: 'actual-id', acct: 'actual@remote.test', display_name: 'Actual Author', avatar: 'https://remote.test/avatar.png', }) const presented = accountForStatus( status({ account: original, content: '

Hello —Helene

' }), true, ) expect(presented).toMatchObject({ id: 'actual-id', acct: 'actual@remote.test', display_name: 'Helene', }) expect(presented.avatar).toContain('helene') expect(presented.avatar_static).toBe(presented.avatar) expect(original.display_name).toBe('Actual Author') }) it('does nothing while the feature is disabled', () => { const original = account() expect( accountForStatus(status({ account: original, content: '

—Helene

' }), false), ).toBe(original) }) })