Help with action tests

I can't figure out what's wrong with my code. For my tags resource, I have the following data editing test, which works very well.
test('Edit tag', function () {

$tag = Tag::factory()->create();

livewire(ListTags::class)
->callTableAction(EditAction::class, $tag, data: [
'title' => $title = 'Editing tag',
])
->assertHasNoTableActionErrors();

expect($tag->refresh())->title->toBe($title);

});
test('Edit tag', function () {

$tag = Tag::factory()->create();

livewire(ListTags::class)
->callTableAction(EditAction::class, $tag, data: [
'title' => $title = 'Editing tag',
])
->assertHasNoTableActionErrors();

expect($tag->refresh())->title->toBe($title);

});
I have the following similar code for my tasks resource, but this code doesn't work.
test('Edit simple task', function () {

$task = Task::factory()->create();

livewire(ListTasks::class)
->callTableAction(EditAction::class, $task, data: [
'title' => $title = 'Editing task',
])
->assertHasNoTableActionErrors();

expect($task->refresh())->title->toBe($title);

});
test('Edit simple task', function () {

$task = Task::factory()->create();

livewire(ListTasks::class)
->callTableAction(EditAction::class, $task, data: [
'title' => $title = 'Editing task',
])
->assertHasNoTableActionErrors();

expect($task->refresh())->title->toBe($title);

});
It's as if the persistence in the database doesn't happen for tasks. It also doesn't work for deleting records. I've been stuck on this for 3 days. Could someone help me?
Failed asserting that two strings are identical.
Expected :'Editing task'
Actual :'Et omnis corrupti hic.'
Failed asserting that two strings are identical.
Expected :'Editing task'
Actual :'Et omnis corrupti hic.'
1 Reply
sfrigzs
sfrigzsOP7mo ago
Hello devs, could someone give me tips for troubleshooting?
Want results from more Discord servers?
Add your server