feat(knowledge): add noteType field to Note model, api, repository, provider

This commit is contained in:
2026-04-04 23:37:53 -04:00
parent e89626a782
commit c8cdcbf230
5 changed files with 55 additions and 8 deletions
+28 -3
View File
@@ -1,8 +1,33 @@
// Placeholder — integration tests go here once the app is running on device.
import 'package:fabled_app/data/models/note.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('placeholder', () {
expect(true, isTrue);
group('Note.fromJson', () {
test('parses noteType when present', () {
final json = {
'id': 1,
'title': 'Alice',
'body': '',
'tags': <dynamic>[],
'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': <dynamic>[],
'created_at': '2024-01-01T00:00:00',
'updated_at': '2024-01-01T00:00:00',
};
final note = Note.fromJson(json);
expect(note.noteType, equals('note'));
});
});
}