Added Tests
parent
2ff821447f
commit
05f293d1b4
|
@ -1,12 +1,11 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:smoke_cess_app/mock/settings_mock.dart';
|
|
||||||
import 'package:smoke_cess_app/services/date_service.dart';
|
import 'package:smoke_cess_app/services/date_service.dart';
|
||||||
import 'package:smoke_cess_app/services/pages_service.dart';
|
import 'package:smoke_cess_app/services/pages_service.dart';
|
||||||
import 'package:smoke_cess_app/services/settings_service.dart';
|
|
||||||
import 'package:timezone/data/latest.dart' as tz;
|
import 'package:timezone/data/latest.dart' as tz;
|
||||||
import 'package:timezone/timezone.dart';
|
import 'package:timezone/timezone.dart';
|
||||||
|
import '../mock/settings_mock.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
tz.initializeTimeZones();
|
tz.initializeTimeZones();
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:smoke_cess_app/providers/input_provider.dart';
|
import 'package:smoke_cess_app/providers/input_provider.dart';
|
||||||
|
import 'package:smoke_cess_app/globals.dart' as globals;
|
||||||
|
|
||||||
|
import '../mock/db_mock.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
globals.databaseService = DatabaseMock();
|
||||||
group('InputProvider', () {
|
group('InputProvider', () {
|
||||||
test('Initial values are correct', () {
|
test('Initial values are correct', () {
|
||||||
late final inputProvider = InputProvider();
|
late final inputProvider = InputProvider();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:smoke_cess_app/mock/settings_mock.dart';
|
|
||||||
import 'package:smoke_cess_app/providers/settings_provider.dart';
|
import 'package:smoke_cess_app/providers/settings_provider.dart';
|
||||||
|
import '../mock/settings_mock.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
|
@ -3,9 +3,12 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:smoke_cess_app/providers/audio_provider.dart';
|
import 'package:smoke_cess_app/providers/audio_provider.dart';
|
||||||
import 'package:smoke_cess_app/providers/timer_provider.dart';
|
import 'package:smoke_cess_app/providers/timer_provider.dart';
|
||||||
import 'package:smoke_cess_app/providers/workout_provider.dart';
|
import 'package:smoke_cess_app/providers/workout_provider.dart';
|
||||||
|
import 'package:smoke_cess_app/globals.dart' as globals;
|
||||||
|
import '../mock/db_mock.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
globals.databaseService = DatabaseMock();
|
||||||
group('WorkoutProvider', () {
|
group('WorkoutProvider', () {
|
||||||
late WorkoutProvider workoutProvider;
|
late WorkoutProvider workoutProvider;
|
||||||
late TimerProvider timerProvider;
|
late TimerProvider timerProvider;
|
||||||
|
@ -65,12 +68,14 @@ void main() {
|
||||||
expect(workoutProvider.isWorkoutComplete, false);
|
expect(workoutProvider.isWorkoutComplete, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
// test('save workout', () {
|
test('save workout', () async {
|
||||||
// workoutProvider.motivationBefore = 70;
|
workoutProvider.motivationBefore = 70;
|
||||||
// workoutProvider.motivationAfter = 80;
|
workoutProvider.motivationAfter = 80;
|
||||||
// workoutProvider.saveWorkout();
|
workoutProvider.saveWorkout();
|
||||||
|
|
||||||
// // -> hier in datenbank nachschauen obs geklappt hat
|
final result = await globals.databaseService.getWorkoutRecords();
|
||||||
// });
|
|
||||||
|
expect(result.length, 1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue