import 'package:famedlysdk/src/utils/markdown.dart'; import 'package:test/test.dart'; void main() { group('markdown', () { final emotePacks = { 'room': { ':fox:': 'mxc://roomfox', ':bunny:': 'mxc://roombunny', }, 'user': { ':fox:': 'mxc://userfox', ':bunny:': 'mxc://userbunny', ':raccoon:': 'mxc://raccoon', }, }; test('simple markdown', () { expect(markdown('hey *there* how are **you** doing?'), 'hey there how are you doing?'); expect(markdown('wha ~~strike~~ works!'), 'wha strike works!'); }); test('spoilers', () { expect(markdown('Snape killed ||Dumbledoor||'), 'Snape killed Dumbledoor'); expect(markdown('Snape killed ||Story|Dumbledoor||'), 'Snape killed Dumbledoor'); }); test('multiple paragraphs', () { expect(markdown('Heya!\n\nBeep'), '

Heya!

\n

Beep

'); }); test('Other block elements', () { expect(markdown('# blah\n\nblubb'), '

blah

\n

blubb

'); }); test('linebreaks', () { expect(markdown('foxies\ncute'), 'foxies
\ncute'); }); test('emotes', () { expect(markdown(':fox:', emotePacks), ':fox:'); expect(markdown(':user~fox:', emotePacks), ':fox:'); expect(markdown(':raccoon:', emotePacks), ':raccoon:'); expect(markdown(':invalid:', emotePacks), ':invalid:'); expect(markdown(':room~invalid:', emotePacks), ':room~invalid:'); }); }); }