chore(wip): lot #165-169 validé QA + rework foreground #163 (KO - preuve device/toolchain insuffisante)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -98,6 +98,44 @@ void main() {
|
||||
expect(env.repository.stepResults, hasLength(1));
|
||||
});
|
||||
|
||||
test('routes completeCurrentStep to completed reps step', () async {
|
||||
final session = _session(
|
||||
steps: [_step(type: ExerciseStepType.reps, defaultTargetValue: 12)],
|
||||
);
|
||||
final env = _env(
|
||||
session: session,
|
||||
projection: _projection(
|
||||
stepType: WatchStepType.reps,
|
||||
stepTargetValue: 12,
|
||||
),
|
||||
);
|
||||
env.repository.stepProgressStates['step-state'] = _stepState(
|
||||
sessionId: session.metadata.id,
|
||||
);
|
||||
|
||||
final ack = await env.dispatch(WatchCommandType.completeCurrentStep);
|
||||
|
||||
expect(ack, WatchCommandAck.accepted);
|
||||
expect(env.repository.stepResults.single.status, SetResultStatus.completed);
|
||||
expect(env.repository.stepResults.single.actualReps, 12);
|
||||
});
|
||||
|
||||
test(
|
||||
'rejects completeCurrentStep when current projection is not reps',
|
||||
() async {
|
||||
final session = _session(steps: [_step()]);
|
||||
final env = _env(session: session, projection: _projection());
|
||||
env.repository.stepProgressStates['step-state'] = _stepState(
|
||||
sessionId: session.metadata.id,
|
||||
);
|
||||
|
||||
final ack = await env.dispatch(WatchCommandType.completeCurrentStep);
|
||||
|
||||
expect(ack, WatchCommandAck.rejectedNotApplicable);
|
||||
expect(env.repository.stepResults, isEmpty);
|
||||
},
|
||||
);
|
||||
|
||||
test('routes skipCurrentPassage to step use case', () async {
|
||||
final session = _session(
|
||||
targetReps: 2,
|
||||
@ -542,6 +580,8 @@ WatchSessionProjection _projection({
|
||||
double? currentManualScoreValue,
|
||||
bool canDecrementScore = false,
|
||||
WatchManualScoreScope? manualScoreScope,
|
||||
WatchStepType? stepType,
|
||||
int? stepTargetValue,
|
||||
}) {
|
||||
return WatchSessionProjection(
|
||||
deviceSessionId: deviceSessionId,
|
||||
@ -557,6 +597,8 @@ WatchSessionProjection _projection({
|
||||
hasManualScore: hasManualScore,
|
||||
currentManualScoreValue: currentManualScoreValue,
|
||||
canDecrementScore: canDecrementScore,
|
||||
stepType: stepType,
|
||||
stepTargetValue: stepTargetValue,
|
||||
manualScoreScope:
|
||||
manualScoreScope ??
|
||||
(hasManualScore ? WatchManualScoreScope.series : null),
|
||||
@ -617,6 +659,8 @@ ActiveWorkoutSession _session({
|
||||
ExerciseStep _step({
|
||||
String id = 'step-1',
|
||||
int position = 0,
|
||||
ExerciseStepType type = ExerciseStepType.time,
|
||||
int defaultTargetValue = 1,
|
||||
bool hasScore = false,
|
||||
String? scoreLabel,
|
||||
String? scoreUnit,
|
||||
@ -626,8 +670,8 @@ ExerciseStep _step({
|
||||
id: id,
|
||||
position: position,
|
||||
name: 'Step ${position + 1}',
|
||||
type: ExerciseStepType.time,
|
||||
defaultTargetValue: 1,
|
||||
type: type,
|
||||
defaultTargetValue: defaultTargetValue,
|
||||
hasScore: hasScore,
|
||||
scoreLabel: scoreLabel,
|
||||
scoreUnit: scoreUnit,
|
||||
@ -701,6 +745,8 @@ final class _FakeProjectionSource implements WatchProjectionSource {
|
||||
seriesIndex: projection.seriesIndex,
|
||||
seriesTotal: projection.seriesTotal,
|
||||
exerciseName: projection.exerciseName,
|
||||
stepType: projection.stepType,
|
||||
stepTargetValue: projection.stepTargetValue,
|
||||
primaryAction: projection.primaryAction,
|
||||
secondaryActions: projection.secondaryActions,
|
||||
hasManualScore: projection.hasManualScore,
|
||||
|
||||
Reference in New Issue
Block a user