@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Laravel\Fortify\Features;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -18,10 +19,44 @@ test('new users can register', function () {
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'password',
|
||||
'password_confirmation' => 'password',
|
||||
'plan' => 'pro',
|
||||
]);
|
||||
|
||||
$response->assertSessionHasNoErrors()
|
||||
->assertRedirect(route('dashboard', absolute: false));
|
||||
->assertRedirect(route('pricing', absolute: false));
|
||||
|
||||
$this->assertAuthenticated();
|
||||
});
|
||||
|
||||
test('new users are given a personal organization to subscribe with', function () {
|
||||
$this->post(route('register.store'), [
|
||||
'name' => 'John Doe',
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'password',
|
||||
'password_confirmation' => 'password',
|
||||
'plan' => 'pro',
|
||||
]);
|
||||
|
||||
$user = User::where('email', 'test@example.com')->sole();
|
||||
|
||||
expect($user->currentOrganization()->first())
|
||||
->not->toBeNull()
|
||||
->personal_workspace->toBeTrue()
|
||||
->lifetime_access->toBeFalse();
|
||||
});
|
||||
|
||||
test('a new user is sent to pricing because they have not subscribed', function () {
|
||||
$this->post(route('register.store'), [
|
||||
'name' => 'John Doe',
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'password',
|
||||
'password_confirmation' => 'password',
|
||||
'plan' => 'pro',
|
||||
]);
|
||||
|
||||
$user = User::where('email', 'test@example.com')->sole();
|
||||
|
||||
expect($user->hasActiveSubscription())->toBeFalse();
|
||||
|
||||
$this->actingAs($user)->get(route('dashboard'))->assertRedirect(route('pricing'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user