fix(viewer): RegisterViewer defaults to post-tutorial TutorialState=100

BuildDefaultViewer hardcoded TutorialState=1 — correct for fresh anonymous
signups (RegisterAnonymousViewer) but wrong for AdminController.ImportViewer
and Steam-social signups, which both go through RegisterViewer and expect a
prod-replica viewer that boots to the home screen. Add an initialTutorialState
parameter (default 1 preserves RegisterAnonymousViewer behavior); RegisterViewer
passes 100.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-28 20:07:05 -04:00
parent c2c6a95170
commit b50a884af9
2 changed files with 29 additions and 11 deletions

View File

@@ -141,6 +141,24 @@ public class ViewerRepositoryTests
await repo.RegisterAnonymousViewer(Guid.Empty));
}
[Test]
public async Task RegisterViewer_starts_at_post_tutorial_state()
{
using var factory = new SVSimTestFactory();
using var scope = factory.Services.CreateScope();
var repo = scope.ServiceProvider.GetRequiredService<IViewerRepository>();
var viewer = await repo.RegisterViewer(
"Imported Viewer",
SVSim.Database.Enums.SocialAccountType.Steam,
socialAccountIdentifier: 76_561_198_000_000_999UL);
Assert.That(viewer.MissionData.TutorialState, Is.EqualTo(100),
"RegisterViewer (admin-import + Steam-social signup) must produce a post-tutorial " +
"viewer by default. Import requests can override via request.TutorialState; absence " +
"means 'a prod-replica viewer ready for the home screen', NOT 'replay tutorial'.");
}
[Test]
public async Task GetViewerByUdid_returns_viewer_or_null()
{