feat(knowledge): add noteType field to Note model, api, repository, provider
This commit is contained in:
+28
-3
@@ -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'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user