user = User::factory()->create(); $this->workspace = Workspace::factory()->create(['user_id' => $this->user->id]); $this->workspace->members()->attach($this->user->id, ['role' => Role::Member->value]); $this->user->update(['current_workspace_id' => $this->workspace->id]); }); test('get workspace returns sanitized WorkspaceResource shape', function () { $response = TryPostServer::actingAs($this->user) ->tool(GetWorkspaceTool::class, []); $response->assertOk() ->assertStructuredContent(function (AssertableJson $json) { $json->where('id', $this->workspace->id) ->where('name', $this->workspace->name) ->hasAll(['created_at', 'updated_at']) ->missing('account_id') ->missing('user_id') ->missing('brand_color') ->missing('content_language'); }); });