added pricing, orgs
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-04 20:34:19 -07:00
parent 999d5ad28d
commit 2ca3860557
52 changed files with 3467 additions and 47 deletions
+36 -1
View File
@@ -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'));
});