import 'package:fabled_app/data/models/note.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('Note.fromJson', () { test('parses noteType when present', () { final json = { 'id': 1, 'title': 'Alice', 'body': '', 'tags': [], 'note_type': 'person', 'created_at': '2024-01-01T00:00:00', 'updated_at': '2024-01-01T00:00:00', }; final note = Note.fromJson(json); expect(note.noteType, equals('person')); }); test('defaults noteType to note when absent', () { final json = { 'id': 2, 'title': 'My note', 'body': '', 'tags': [], 'created_at': '2024-01-01T00:00:00', 'updated_at': '2024-01-01T00:00:00', }; final note = Note.fromJson(json); expect(note.noteType, equals('note')); }); }); }