GardenPlanner/test/api/api_entities/beet_entry_test.dart

35 lines
980 B
Dart
Raw Normal View History

2023-06-25 10:13:39 +02:00
import 'package:flutter_test/flutter_test.dart';
import 'package:garden_planner/api/api_entities/beet_entry.dart';
void main() {
test('BeetEntry entity Test', () {
// Arrange
const int plantId = 1;
const int position = 2;
const int beetrow = 3;
// Act
final beetEntry = BeetEntry(plantId, position, beetrow);
// Assert
expect(beetEntry.plantId, equals(plantId));
expect(beetEntry.position, equals(position));
expect(beetEntry.beetRow, equals(beetrow));
});
test('BeetEntry entity toJson() should work', () {
// Arrange
const int plantId = 1;
const int position = 2;
const int beetrow = 3;
// Act
final beetEntry = BeetEntry(plantId, position, beetrow);
// Act
final jsonMap = beetEntry.toJson();
// Assert
expect(jsonMap, isA<Map<String, dynamic>>());
expect(jsonMap['plantId'], equals(1));
expect(jsonMap['position'], equals(2));
expect(jsonMap['beet_row'], equals(3));
});
}