trypost/tests/Unit/Ai/Agents/PostContentReviewerTest.php
Axi 3baf2e9c41
Add Ukrainian as a supported platform language (#219)
* Default AI content language to Ukrainian

* Keep English as the default content language

* refactor: update content language handling in workspace creation

- Changed the default content language in CreateWorkspace to inherit the app's locale instead of defaulting to English.
- Updated related tests to reflect this change, ensuring that the content language aligns with the application's current locale settings.
- Cleaned up unnecessary code in the BrandTab component for better readability.

* Add Ukrainian as a full platform UI locale.

Wire uk into languages config with complete lang/uk translations and restore ContentLanguage↔UI parity checks.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Wire Ukrainian into dayjs and locale coverage tests.

Import the uk dayjs locale with Monday week-start and cover uk/uk-UA in brand autofill and SetLocale assertions.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Harden Ukrainian UI and AI content-language coverage.

Cover generator/reviewer/humanizer/image prompts, workspace pickers, persona labels, UI locale switch, and README for uk as a first-class platform language.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add Ukrainian Pinterest form strings after main merge.

Restore lang/uk posts.php key parity for the new pin title and destination link fields.

Co-authored-by: Cursor <cursoragent@cursor.com>

* List every supported UI language in the README.

Replace the abbreviated multi-language blurb with the full locale set from config.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Paulo Castellano <paulo@castellanos.llc>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 19:45:30 -03:00

40 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
use App\Ai\Agents\PostContentReviewer;
use App\Models\Workspace;
use Illuminate\JsonSchema\JsonSchemaTypeFactory;
test('instructions render brand context and language', function () {
$workspace = Workspace::factory()->make([
'name' => 'TryPost',
'brand_voice_traits' => ['friendly', 'concise'],
'content_language' => 'pt-BR',
]);
$agent = new PostContentReviewer(workspace: $workspace);
$instructions = $agent->instructions();
expect($instructions)->toContain('TryPost');
expect($instructions)->toContain('friendly'); // "Be warm and friendly."
expect($instructions)->toContain('short'); // "Keep sentences short and objective."
expect($instructions)->toContain('pt-BR');
});
test('instructions use Ukrainian when the workspace content language is uk', function () {
$workspace = Workspace::factory()->make([
'content_language' => 'uk',
]);
expect((new PostContentReviewer(workspace: $workspace))->instructions())
->toContain('Output language: uk.');
});
test('schema requires suggestions array with original/suggestion/reason', function () {
$workspace = Workspace::factory()->make();
$agent = new PostContentReviewer(workspace: $workspace);
$schema = $agent->schema(new JsonSchemaTypeFactory);
expect($schema)->toHaveKey('suggestions');
});