ramadanproject/tests/Feature/ValidateSelectionTest.php
Ahmed Darrazi 45a147253c
Some checks failed
tests / ci (push) Failing after 6m13s
linter / quality (pull_request) Failing after 58s
linter / quality (push) Failing after 1m19s
tests / ci (pull_request) Failing after 5m28s
feat(public-grid): add QA, quickstart, decision docs; scheduler docs; ignore files; tasks updates; run pint
2026-01-03 04:56:12 +01:00

29 lines
723 B
PHP

<?php
use App\Models\MasterImage;
use Illuminate\Support\Facades\Storage;
it('validates and maps pixel selection to cell units', function () {
// Ensure a master image exists so config and storage are stable
MasterImage::create(['path' => 'master.png', 'version' => 1]);
$payload = [
'x' => 50,
'y' => 40,
'w' => 60,
'h' => 40,
'offsetX' => 10,
'offsetY' => 20,
];
$response = $this->postJson('/api/grid/validate-selection', $payload);
$response->assertSuccessful();
$json = $response->json('selection');
expect($json['x'])->toBe(2);
expect($json['y'])->toBe(1);
expect($json['w'])->toBe(3);
expect($json['h'])->toBe(2);
});