added test

main
Julian Gegner 2022-11-07 22:26:47 +01:00
parent a60e9f968b
commit 8193b80feb
2 changed files with 10 additions and 48 deletions

View File

@ -1,21 +1,13 @@
import 'dart:async';
import 'package:energy_bilance/models/EnergyBilanceModel.dart'; import 'package:energy_bilance/models/EnergyBilanceModel.dart';
import 'package:flutter_test/flutter_test.dart';
void main() async { void main() async {
//Location _locationModel;StreamController<Location> _controller;setUp(() { EnergyBilanceModel model = EnergyBilanceModel();
_controller = StreamController<EnergyBilanceModel>();
_energyModel = EnergyBilanceModel(); group("Testing EnergyBilanceModel", () {
});group('[Location Model]', () { test("blalbb", () async {
//test('[Model] Check individual values', () async { model.setWeight(5.0);
_locationModel = Location( expect(0, model.potentialEnergy);
city: 'London', });
countryName: 'England', });
country: 'England', }
currency: 'GBP',
ip: '',
inEu: true,
languages: 'EN',
);// BEGIN TESTS....
expect(_locationModel.city, 'London');expect(_locationModel.countryName.runtimeType, equals(String));expect(_locationModel.country, isNotNull);expect(_locationModel.ip, isEmpty);expect(_locationModel.inEu, isTrue);expect(_locationModel.languages, contains('EN'));expect(_locationModel.currency, startsWith('G'));expect(_locationModel.country, matches('England'));
});}

View File

@ -1,30 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:energy_bilance/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}