From 2fa475e10aa27f94427572b3520afc3cb13cd88a Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Wed, 29 Jul 2020 16:29:27 +0200 Subject: [PATCH] Add an extra test for txt files and the title Just to make sure it's never parsed. --- test/note_test.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/note_test.dart b/test/note_test.dart index dcaba5cb..16e71c1d 100644 --- a/test/note_test.dart +++ b/test/note_test.dart @@ -199,5 +199,23 @@ Gee var path = note.filePath; expect(path.endsWith('.md'), true); }); + + test('Txt files header is not read', () async { + var content = """# Hello + +Gee +"""; + var txtNotePath = p.join(tempDir.path, "note163.txt"); + await File(txtNotePath).writeAsString(content); + + var parentFolder = NotesFolderFS(null, tempDir.path); + var txtNote = Note(parentFolder, txtNotePath); + await txtNote.load(); + + expect(txtNote.fileFormat, NoteFileFormat.Txt); + expect(txtNote.canHaveMetadata, false); + expect(txtNote.title.isEmpty, true); + expect(txtNote.body, content); + }); }); }