Save workspace changes
This commit is contained in:
@@ -2,35 +2,21 @@
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Jobs\SendVerificationEmailJob;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('completes happy path registration onboarding flow', function () {
|
||||
Queue::fake();
|
||||
|
||||
$register = $this->post('/register', [
|
||||
'email' => 'flow-user@example.com',
|
||||
]);
|
||||
|
||||
$register->assertRedirect('/register/notice');
|
||||
$register->assertRedirect('/setup/password');
|
||||
|
||||
$user = User::query()->where('email', 'flow-user@example.com')->firstOrFail();
|
||||
expect($user->onboarding_step)->toBe('email');
|
||||
|
||||
$token = null;
|
||||
Queue::assertPushed(SendVerificationEmailJob::class, function (SendVerificationEmailJob $job) use (&$token) {
|
||||
$token = $job->token;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$this->get('/verify/' . $token)->assertRedirect('/setup/password');
|
||||
|
||||
$user->refresh();
|
||||
expect($user->onboarding_step)->toBe('verified');
|
||||
expect($user->email_verified_at)->toBeNull();
|
||||
$this->assertAuthenticatedAs($user);
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/setup/password', [
|
||||
@@ -79,8 +65,6 @@ it('rejects expired verification token', function () {
|
||||
});
|
||||
|
||||
it('rejects duplicate email at registration', function () {
|
||||
Queue::fake();
|
||||
|
||||
User::factory()->create([
|
||||
'email' => 'duplicate-check@example.com',
|
||||
'email_verified_at' => now(),
|
||||
@@ -88,13 +72,12 @@ it('rejects duplicate email at registration', function () {
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$response = $this->post('/register', [
|
||||
$response = $this->from('/register')->post('/register', [
|
||||
'email' => 'duplicate-check@example.com',
|
||||
]);
|
||||
|
||||
$response->assertRedirect('/register/notice');
|
||||
$response->assertSessionHas('status', 'If that email is valid, we sent a verification link.');
|
||||
Queue::assertNothingPushed();
|
||||
$response->assertRedirect('/register');
|
||||
$response->assertSessionHasErrors('email');
|
||||
});
|
||||
|
||||
it('rejects username conflict during username setup', function () {
|
||||
|
||||
Reference in New Issue
Block a user