Files
GitJournal/test/strip_markdown_formatting_test.dart
Vishesh Handa 0d5793d097 strip_markdown: Use a handbuilt stripper
It's not perfect, but it runs faster at about 35 us vs 650 us.
2020-02-17 15:51:37 +01:00

46 lines
933 B
Dart

import 'package:gitjournal/utils/markdown.dart';
import 'package:test/test.dart';
void main() {
group('Markdown Remove Formatting', () {
test('Test Headers', () {
var input = '# Hello\nHow are you?';
expect(stripMarkdownFormatting(input), 'Hello How are you? ');
});
test('Test Header2', () {
var input = """Test Header
----------
Hello
""";
expect(stripMarkdownFormatting(input), 'Test Header Hello ');
});
test('Itemized LIsts', () {
var input = """Itemized lists
look like:
* this one
* that one
""";
expect(stripMarkdownFormatting(input),
'Itemized lists look like: * this one * that one ');
});
test('Checklist', () {
var input = """Itemized lists
[ ] this one
[x] that one
[X] last
""";
expect(stripMarkdownFormatting(input),
'Itemized lists ☐ this one ☑ that one ☑ last ');
});
});
}