assertSchemaSet

This commit is contained in:
Dan Harrin
2025-04-21 13:01:26 +01:00
parent 9c4d71195a
commit 6769deb392
2 changed files with 3 additions and 14 deletions
+2 -2
View File
@@ -127,7 +127,7 @@ it('can validate invoice recipient email', function () {
});
```
To check if an action is pre-filled with data, you can use the `assertActionDataSet()` method:
To check if an action is pre-filled with data, you can use the `assertSchemaSet()` method:
```php
use function Pest\Livewire\livewire;
@@ -140,7 +140,7 @@ it('can send invoices to the primary contact by default', function () {
'invoice' => $invoice,
])
->mountAction('send')
->assertActionDataSet([
->assertSchemaSet([
'email' => $recipientEmail,
])
->callMountedAction()
+1 -12
View File
@@ -79,18 +79,7 @@ class TestsActions
public function assertActionDataSet(): Closure
{
return function (array | Closure $data): static {
$mountedActions = $this->instance()->mountedActions;
$mountedActionIndex = array_key_last($mountedActions);
if ($data instanceof Closure) {
$data = $data($mountedActions[$mountedActionIndex]['data'] ?? []);
}
if (is_array($data)) {
foreach (Arr::dot($data, prepend: "mountedActions.{$mountedActionIndex}.data.") as $key => $value) {
$this->assertSet($key, $value);
}
}
$this->assertSchemaSet($data);
return $this;
};