diff --git a/SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs b/SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs index 1eef314..13cf1b5 100644 --- a/SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs +++ b/SVSim.UnitTests/Infrastructure/SVSimTestFactory.cs @@ -174,13 +174,14 @@ internal sealed class SVSimTestFactory : WebApplicationFactory await db.SaveChangesAsync(); } - // Third scope: override TutorialState to the requested value when non-zero. - // BuildDefaultViewer now starts viewers at 0 (PRE_TUTORIAL_STEP). Tests that want - // a pre-completed-tutorial viewer (the common case for existing tests) pass the - // default tutorialState=100 here. - if (tutorialState != 0) + // Third scope: write the requested TutorialState. The parameter defaults to 100 — + // the post-tutorial baseline that ~30 existing tests rely on — so callers that don't + // care about the tutorial step keep working unchanged. Pass tutorialState: 1 to seed + // a fresh-signup viewer, or any other value to land mid-tutorial. RegisterViewer's + // own default (set in BuildDefaultViewer) is irrelevant here because this override + // always runs. + using (var scope = Services.CreateScope()) { - using var scope = Services.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var viewer = await db.Viewers.Include(v => v.MissionData).FirstAsync(v => v.Id == viewerId); viewer.MissionData.TutorialState = tutorialState;