Line data Source code
1 : import 'package:stay_points/stay_points.dart';
2 : import 'package:test/test.dart';
3 :
4 : void main() {
5 1 : group('Stay-point', () {
6 : final lat1 = 41.139129;
7 : final lon1 = 1.402244;
8 1 : final DateTime date = new DateTime.now();
9 : Location location;
10 :
11 1 : setUp(() {
12 1 : location = new Location.fromDegrees(latitude: lat1,longitude: lon1, timestamp: date);
13 : });
14 :
15 1 : test('Locations involved not null after using the basic constructor', () {
16 6 : StayPoint stayPoint = new StayPoint(latitude: location.latitude, longitude: location.longitude, arrival: new DateTime.now(), departure: new DateTime.now(), locationsInvolved: [location]);
17 2 : expect(stayPoint.locationsInvolved, isNotNull);
18 : });
19 :
20 1 : test('Locations involved should return somehitng after using the basic constructor', () {
21 6 : StayPoint stayPoint = new StayPoint(latitude: location.latitude, longitude: location.longitude, arrival: new DateTime.now(), departure: new DateTime.now(), locationsInvolved: [location]);
22 4 : expect(stayPoint.locationsInvolved.length, greaterThan(0));
23 : });
24 :
25 :
26 1 : test('StayPoint fromLocations should match values', () {
27 :
28 2 : StayPoint stayPoint = new StayPoint.fromLocations(locationsInvolved: [location]);
29 :
30 3 : bool match = stayPoint.location.compareTo(location) == 0
31 3 : && stayPoint.arrival.compareTo(date) == 0
32 3 : && stayPoint.departure.compareTo(date) == 0
33 4 : && stayPoint.locationsInvolved.first.compareTo(location) == 0;
34 :
35 1 : expect(match, isTrue);
36 : });
37 :
38 : });
39 : }
|