true]); $user = User::factory()->create(['setup' => Setup::Completed]); $workspace = Workspace::factory()->create(['user_id' => $user->id]); $workspace->members()->attach($user->id, ['role' => Role::Member->value]); $user->update(['current_workspace_id' => $workspace->id]); $this->actingAs($user) ->get(route('app.calendar')) ->assertOk(); }); test('user on role step is redirected to onboarding step 1', function () { config(['trypost.self_hosted' => true]); $user = User::factory()->create(['setup' => Setup::Role]); $workspace = Workspace::factory()->create(['user_id' => $user->id]); $workspace->members()->attach($user->id, ['role' => Role::Member->value]); $user->update(['current_workspace_id' => $workspace->id]); $this->actingAs($user) ->get(route('app.calendar')) ->assertRedirect(route('app.onboarding.role')); }); test('user on connections step is redirected to onboarding step 2', function () { config(['trypost.self_hosted' => true]); $user = User::factory()->create(['setup' => Setup::Connections]); $workspace = Workspace::factory()->create(['user_id' => $user->id]); $workspace->members()->attach($user->id, ['role' => Role::Member->value]); $user->update(['current_workspace_id' => $workspace->id]); $this->actingAs($user) ->get(route('app.calendar')) ->assertRedirect(route('app.onboarding.account')); }); test('user on role step can access onboarding step 1', function () { $user = User::factory()->create(['setup' => Setup::Role]); $this->actingAs($user) ->get(route('app.onboarding.role')) ->assertOk(); }); test('user on connections step can access onboarding step 2', function () { $user = User::factory()->create(['setup' => Setup::Connections]); $this->actingAs($user) ->get(route('app.onboarding.account')) ->assertOk(); }); test('user on connections step can access social connect routes', function () { $user = User::factory()->create(['setup' => Setup::Connections]); $this->actingAs($user) ->get(route('app.social.linkedin.connect')) ->assertRedirect(); });