import 'package:flutter_test/flutter_test.dart';
import 'package:marianum_mobile/view/pages/talk/data/talk_markdown.dart';

void main() {
  group('markdownToPlainText', () {
    test('strips emphasis markers', () {
      expect(
        markdownToPlainText('**bold** and _italic_ and ~~struck~~'),
        'bold and italic and struck',
      );
    });

    test('drops heading markers', () {
      expect(markdownToPlainText('# Title'), 'Title');
    });

    test('reduces links to their label and images to their alt text', () {
      expect(markdownToPlainText('see [the docs](https://x.y)'), 'see the docs');
      expect(markdownToPlainText('![a cat](https://x.y/c.png)'), 'a cat');
    });

    test('flattens lists into one space-separated line', () {
      expect(markdownToPlainText('- one\n- two\n- three'), 'one two three');
    });

    test('unwraps inline code without the backticks', () {
      expect(markdownToPlainText('run `flutter test` now'), 'run flutter test now');
    });

    test('keeps plain text unchanged', () {
      expect(markdownToPlainText('just a normal sentence.'), 'just a normal sentence.');
    });

    test('leaves literal angle brackets intact (no HTML interpretation)', () {
      expect(markdownToPlainText('a <b>tag</b>'), 'a <b>tag</b>');
    });
  });
}
