feat: locale

This commit is contained in:
2026-05-21 21:32:20 +02:00
parent 19e65e36f3
commit 8e5a50dd2b
21 changed files with 337 additions and 32 deletions
+6
View File
@@ -22,6 +22,7 @@ it('returns nutrition goals with the authenticated user', function () {
$this->getJson('/api/auth/me')
->assertOk()
->assertJsonPath('data.locale', 'en')
->assertJsonPath('data.nutritionGoals.calories', 2400)
->assertJsonPath('data.nutritionGoals.proteins', 140)
->assertJsonPath('data.nutritionGoals.carbs', 280)
@@ -103,16 +104,19 @@ it('updates profile preferences for the authenticated user', function () {
'pacePreference' => PacePreference::NORMAL->value,
'sex' => UserSex::MAN->value,
'dateOfBirth' => '2003-04-24',
'locale' => 'fr-FR',
])
->assertOk()
->assertJsonPath('data.physicalActivityLevel', PhysicalActivityLevel::MODERATELY_ACTIVE->value)
->assertJsonPath('data.weightGoal', WeightGoal::MAINTAIN_WEIGHT->value)
->assertJsonPath('data.pacePreference', PacePreference::NORMAL->value)
->assertJsonPath('data.sex', UserSex::MAN->value)
->assertJsonPath('data.locale', 'fr')
->assertJsonPath('data.dateOfBirth', '2003-04-24');
$this->assertDatabaseHas('users', [
'id' => $user->id,
'locale' => 'fr',
'physical_activity_level' => PhysicalActivityLevel::MODERATELY_ACTIVE->value,
'weight_goal' => WeightGoal::MAINTAIN_WEIGHT->value,
'pace_preference' => PacePreference::NORMAL->value,
@@ -130,6 +134,7 @@ it('validates profile preferences', function () {
'weightGoal' => 'bulk',
'pacePreference' => 'urgent',
'sex' => 'x',
'locale' => 'es',
'dateOfBirth' => 'tomorrow',
])
->assertUnprocessable()
@@ -138,6 +143,7 @@ it('validates profile preferences', function () {
'weightGoal',
'pacePreference',
'sex',
'locale',
'dateOfBirth',
]);
});