diff --git a/test/note_serializer_test.dart b/test/note_serializer_test.dart index 6f637d49..cfee0e64 100644 --- a/test/note_serializer_test.dart +++ b/test/note_serializer_test.dart @@ -5,9 +5,12 @@ import 'package:test/test.dart'; import 'package:gitjournal/core/md_yaml_doc.dart'; import 'package:gitjournal/core/note.dart'; import 'package:gitjournal/core/note_serializer.dart'; +import 'package:gitjournal/core/notes_folder_fs.dart'; void main() { group('Note Serializer Test', () { + var parent = NotesFolderFS(null, '/tmp'); + test('Test emojis', () { var props = LinkedHashMap.from( {"title": "Why not :coffee:?"}); @@ -16,7 +19,7 @@ void main() { var serializer = NoteSerializer.raw(); serializer.settings.saveTitleAsH1 = false; - var note = Note(null, "file-path-not-important"); + var note = Note(parent, "file-path-not-important"); serializer.decode(doc, note); expect(note.body, "I ❤️ you"); @@ -37,7 +40,7 @@ void main() { var serializer = NoteSerializer.raw(); serializer.settings.saveTitleAsH1 = true; - var note = Note(null, "file-path-not-important"); + var note = Note(parent, "file-path-not-important"); serializer.decode(doc, note); expect(note.body, "I ❤️ you"); @@ -57,7 +60,7 @@ void main() { var serializer = NoteSerializer.raw(); - var note = Note(null, "file-path-not-important"); + var note = Note(parent, "file-path-not-important"); serializer.decode(doc, note); expect(note.body, "I ❤️ you"); @@ -70,7 +73,7 @@ void main() { var serializer = NoteSerializer.raw(); - var note = Note(null, "file-path-not-important"); + var note = Note(parent, "file-path-not-important"); serializer.decode(doc, note); expect(note.body.length, 0); @@ -85,7 +88,7 @@ void main() { var serializer = NoteSerializer.raw(); serializer.settings.saveTitleAsH1 = true; - var note = Note(null, "file-path-not-important"); + var note = Note(parent, "file-path-not-important"); serializer.decode(doc, note); expect(note.body, "I ❤️ you"); diff --git a/test/note_storage_test.dart b/test/note_storage_test.dart index d25d3ff8..cb4b48e1 100644 --- a/test/note_storage_test.dart +++ b/test/note_storage_test.dart @@ -6,6 +6,7 @@ import 'package:test/test.dart'; import 'package:gitjournal/core/md_yaml_doc.dart'; import 'package:gitjournal/core/note.dart'; +import 'package:gitjournal/core/notes_folder_fs.dart'; import 'package:gitjournal/utils/datetime.dart'; void main() { @@ -26,11 +27,12 @@ void main() { n1Path = p.join(tempDir.path, "1.md"); n2Path = p.join(tempDir.path, "2.md"); - var n1 = Note(null, n1Path); + var parent = NotesFolderFS(null, tempDir.path); + var n1 = Note(parent, n1Path); n1.body = "test"; n1.created = dt; - var n2 = Note(null, n2Path); + var n2 = Note(parent, n2Path); n2.data = MdYamlDoc("test2", props); notes = [n1, n2]; @@ -49,8 +51,10 @@ void main() { expect(File(n2Path).existsSync(), isTrue); var loadedNotes = []; + var parent = NotesFolderFS(null, tempDir.path); + await Future.forEach(notes, (origNote) async { - var note = Note(null, origNote.filePath); + var note = Note(parent, origNote.filePath); var r = await note.load(); expect(r, NoteLoadState.Loaded);