fix(viewer): fresh signups start at tutorial_state=0, not 100

Previously RegisterAnonymousViewer auto-completed the tutorial, which
prevented the client from ever entering the tutorial flow. SeedViewerAsync
gains a tutorialState parameter (default 100) so existing tests keep
their pre-completed-tutorial assumption.
This commit is contained in:
gamer147
2026-05-28 11:27:37 -04:00
parent 36dd25826b
commit f233a8c8d6
3 changed files with 40 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using SVSim.Database;
using SVSim.Database.Repositories.Viewer;
using SVSim.UnitTests.Infrastructure;
namespace SVSim.UnitTests.Repositories;
public class ViewerRepositoryTutorialDefaultTests
{
[Test]
public async Task RegisterAnonymousViewer_starts_at_tutorial_step_0()
{
using var factory = new SVSimTestFactory();
using var scope = factory.Services.CreateScope();
var repo = scope.ServiceProvider.GetRequiredService<IViewerRepository>();
var viewer = await repo.RegisterAnonymousViewer(Guid.NewGuid());
Assert.That(viewer.MissionData.TutorialState, Is.EqualTo(0),
"Fresh signups must start at PRE_TUTORIAL_STEP=0 so the client triggers the tutorial flow. " +
"Tests that want a pre-completed tutorial should use SeedViewerAsync (which defaults to 100).");
}
}