76 lines
2.6 KiB
Dart
76 lines
2.6 KiB
Dart
|
import 'package:flutter_test/flutter_test.dart';
|
||
|
import 'package:flutter/material.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/workout_provider.dart';
|
||
|
|
||
|
void main() {
|
||
|
group('WorkoutProvider', () {
|
||
|
late WorkoutProvider workoutProvider;
|
||
|
late TimerProvider timerProvider;
|
||
|
late AudioProvider audioProvider;
|
||
|
|
||
|
setUp(() {
|
||
|
timerProvider = TimerProvider();
|
||
|
audioProvider = AudioProvider();
|
||
|
workoutProvider = WorkoutProvider(timerProvider, audioProvider);
|
||
|
});
|
||
|
|
||
|
test('initial values', () {
|
||
|
expect(workoutProvider.isWorkoutStarted, false);
|
||
|
expect(workoutProvider.isWorkoutComplete, false);
|
||
|
expect(workoutProvider.motivationBefore, 50);
|
||
|
expect(workoutProvider.motivationAfter, 50);
|
||
|
expect(workoutProvider.currentPhase, WorkoutPhases.warmUp);
|
||
|
expect(workoutProvider.currentPhaseDuration, const Duration(seconds: 5));
|
||
|
expect(workoutProvider.isPhaseComplete, false);
|
||
|
expect(workoutProvider.currentPhaseColor, Colors.green);
|
||
|
expect(workoutProvider.currentPhaseTitle, 'Warm Up');
|
||
|
});
|
||
|
|
||
|
test('next phase', () {
|
||
|
workoutProvider.nextPhase();
|
||
|
|
||
|
expect(workoutProvider.currentPhase, WorkoutPhases.highIntensity);
|
||
|
expect(workoutProvider.currentPhaseDuration, const Duration(seconds: 4));
|
||
|
expect(workoutProvider.isPhaseComplete, false);
|
||
|
expect(workoutProvider.currentPhaseColor, Colors.red);
|
||
|
expect(workoutProvider.currentPhaseTitle, 'High Intensity');
|
||
|
});
|
||
|
|
||
|
test('start workout', () {
|
||
|
workoutProvider.startWorkout();
|
||
|
|
||
|
expect(workoutProvider.isWorkoutStarted, true);
|
||
|
expect(workoutProvider.isWorkoutComplete, false);
|
||
|
expect(workoutProvider.currentPhase, WorkoutPhases.warmUp);
|
||
|
expect(workoutProvider.currentPhaseDuration, const Duration(seconds: 5));
|
||
|
expect(workoutProvider.isPhaseComplete, false);
|
||
|
});
|
||
|
|
||
|
test('stop workout', () {
|
||
|
workoutProvider.startWorkout();
|
||
|
workoutProvider.stopWorkout();
|
||
|
|
||
|
expect(workoutProvider.isWorkoutStarted, false);
|
||
|
expect(workoutProvider.isWorkoutComplete, true);
|
||
|
});
|
||
|
|
||
|
test('interrupt workout', () {
|
||
|
workoutProvider.startWorkout();
|
||
|
workoutProvider.interruptWorkout();
|
||
|
|
||
|
expect(workoutProvider.isWorkoutStarted, false);
|
||
|
expect(workoutProvider.isWorkoutComplete, false);
|
||
|
});
|
||
|
|
||
|
// test('save workout', () {
|
||
|
// workoutProvider.motivationBefore = 70;
|
||
|
// workoutProvider.motivationAfter = 80;
|
||
|
// workoutProvider.saveWorkout();
|
||
|
|
||
|
// // -> hier in datenbank nachschauen obs geklappt hat
|
||
|
// });
|
||
|
});
|
||
|
}
|