navbar fixa durante a rolagem
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Http\Client\Request as ClientRequest;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TranslationApiTest extends TestCase
|
||||
@@ -24,4 +25,29 @@ class TranslationApiTest extends TestCase
|
||||
$this->postJson('/api/translate', $input)->assertOk()->assertJsonPath('translated_text', 'Hello');
|
||||
$this->postJson('/api/translate', $input)->assertStatus(503);
|
||||
}
|
||||
|
||||
public function test_it_translates_text_batches_for_full_page_translation(): void
|
||||
{
|
||||
config(['services.translation.url' => 'http://translator.test']);
|
||||
Http::fake(['translator.test/translate' => Http::response(['translatedText' => ['Home', 'About us']])]);
|
||||
|
||||
$this->postJson('/api/translate', [
|
||||
'text' => ['Início', 'Sobre nós'],
|
||||
'source_lang' => 'auto',
|
||||
'target_lang' => 'en',
|
||||
])->assertOk()
|
||||
->assertJsonPath('translated_text.0', 'Home')
|
||||
->assertJsonPath('translated_text.1', 'About us');
|
||||
|
||||
Http::assertSent(fn (ClientRequest $request) => $request['q'] === ['Início', 'Sobre nós']);
|
||||
}
|
||||
|
||||
public function test_it_rejects_translation_batches_that_exceed_the_request_limit(): void
|
||||
{
|
||||
$this->postJson('/api/translate', [
|
||||
'text' => array_fill(0, 9, 'Texto'),
|
||||
'source_lang' => 'auto',
|
||||
'target_lang' => 'en',
|
||||
])->assertUnprocessable();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user