Skip to content

Commit

Permalink
Test register/check-valid-email endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
edwh committed Aug 2, 2021
1 parent e3d305f commit 2be98f4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/Feature/Users/Registration/AccountCreationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use DB;
use Hash;
use Mockery;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Tests\TestCase;

class AccountCreationTest extends TestCase
Expand Down Expand Up @@ -91,4 +92,23 @@ public function testLogoutAndBackIn()
$response->assertStatus(302);
$response->assertRedirect('dashboard');
}

public function testValidEmail() {

// Check with a registered email.
$restarter = factory(User::class)->state('Restarter')->create();
$response = $this->post('user/register/check-valid-email', [
'email' => $restarter->email
]);

$this->assertEquals([
'message' => __('auth.email_address_validation'),
], json_decode($response->getContent(), true));

$response = $this->post('user/register/check-valid-email', [
'email' => 'test@invalid.com'
]);

$this->assertNull(json_decode($response->getContent(), true));
}
}

0 comments on commit 2be98f4

Please sign in to comment.