Files
step3/api/QuestionsApi.Tests/UserProfileModelsTests.cs
hz d69a1fd0e3 Sync text zoom preference through the account instead of local settings
Local user://settings.cfg meant zoom level didn't follow a student
across devices/browsers. Question bank and CCS text scale now live on
the user's study profile in Mongo (QuestionTextScale/CcsTextScale),
synced through a new PUT /api/profile/me/text-scale endpoint and the
existing preferences GET/cache already used for study preferences.

Both question_player.gd and ccs_service.gd read the synced value at
startup and react to AccountProfileService.profile_changed so a value
pulled down after login (or changed from another session) applies
without a restart. Backend validates the 0.85-1.35 range and updates
only the field(s) provided via a targeted $set, so it can't clobber
the other scale or the unrelated study-profile preferences.
2026-07-23 03:59:02 -05:00

23 lines
680 B
C#

using QuestionsApi.Models;
using Xunit;
namespace QuestionsApi.Tests;
public sealed class UserProfileModelsTests
{
[Theory]
[InlineData(null, null, true)]
[InlineData(1.0, 1.0, true)]
[InlineData(0.85, 1.35, true)]
[InlineData(0.84, null, false)]
[InlineData(null, 1.36, false)]
public void UpdateTextScaleRequestValidator_EnforcesRange(double? questionScale, double? ccsScale, bool expectedValid)
{
var request = new UpdateTextScaleRequest { QuestionTextScale = questionScale, CcsTextScale = ccsScale };
var error = UpdateTextScaleRequestValidator.Validate(request);
Assert.Equal(expectedValid, error is null);
}
}