-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteractor_test.dart
32 lines (26 loc) · 1.03 KB
/
interactor_test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import 'package:features_weather_domain/features_weather_domain.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:flutter_test/flutter_test.dart';
import 'utils/mock_datasource_impl.dart';
import 'utils/mock_location.dart';
import 'utils/test_module.dart';
main() {
late WeatherInteractor sut;
setUp(() {
TestModule.initModules();
sut = Modular.get<WeatherInteractor>();
});
test('get forecast successful', () async {
final forecast = await sut.getForecast(MockLocation());
expect(forecast.forecast?.length, MockDatasourceImpl.forecastItems);
});
test('get current successful', () async {
final current = await sut.getCurrent();
expect(current.current?.temp, MockDatasourceImpl.temp);
});
test('get forecast item successful', () async {
final forecastItem = await sut.getForecastItem(MockLocation(), MockDatasourceImpl.dateEpoch.toString());
expect(forecastItem?.dateEpoch, MockDatasourceImpl.dateEpoch);
expect(forecastItem?.averageTemp, MockDatasourceImpl.temp);
});
}