test scheduled node controller returns 404 when user missing
This commit is contained in:
parent
f315db6d00
commit
ed4440eec2
1 changed files with 24 additions and 0 deletions
|
|
@ -225,4 +225,28 @@ class ScheduledNodeControllerTest extends TestCase
|
|||
$body = json_decode((string) $response->getBody(), true);
|
||||
$this->assertEquals([], $body);
|
||||
}
|
||||
|
||||
public function test_returns_404_when_use_case_throws_domain_exception(): void
|
||||
{
|
||||
$unknownUser = new User(
|
||||
id: 999,
|
||||
email: new EmailAddress('ghost@test.com'),
|
||||
passwordHash: '',
|
||||
isAdmin: false,
|
||||
);
|
||||
|
||||
$response = $this->controller->getScheduledNodes(
|
||||
$this->makeRequest('2025-01-02', $unknownUser),
|
||||
new Response(),
|
||||
$this->getTodaysSchedule,
|
||||
);
|
||||
|
||||
$this->assertEquals(404, $response->getStatusCode());
|
||||
$body = json_decode((string) $response->getBody(), true);
|
||||
$this->assertArrayHasKey('error', $body);
|
||||
$this->assertEquals(
|
||||
'User with id: 999 doesnt exist',
|
||||
$body['error']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue