test: add tests for WorkspaceTeamService #15

Open
opened 2026-02-20 16:38:27 +00:00 by Clotho · 0 comments
Member

Problem

Services/WorkspaceTeamService.php has no dedicated test file. The service handles team CRUD, member permissions, and team seeding but is only tested indirectly.

Key areas lacking coverage

  • Team creation, update, deletion (including system team protection)
  • Workspace resolution fallback logic (lines 40-57): property → auth user default → session
  • Default team handling when is_default changes (potential for multiple defaults)
  • Permission checks: hasPermission, hasAnyPermission, hasAllPermissions
  • Member assignment to teams and removeMemberFromTeam
  • seedDefaultTeams and ensureDefaultTeams
  • migrateExistingMembers role-to-team mapping
  • setMemberCustomPermissions with invalid JSON structures

Acceptance Criteria

  • Create tests/Feature/WorkspaceTeamServiceTest.php using Pest
  • Cover all public methods with happy-path and edge-case tests
  • Test that only one default team exists after update operations
  • Test system team cannot be deleted

Discovered during automated scan (issue #3)

## Problem `Services/WorkspaceTeamService.php` has no dedicated test file. The service handles team CRUD, member permissions, and team seeding but is only tested indirectly. ## Key areas lacking coverage - Team creation, update, deletion (including system team protection) - Workspace resolution fallback logic (lines 40-57): property → auth user default → session - Default team handling when `is_default` changes (potential for multiple defaults) - Permission checks: `hasPermission`, `hasAnyPermission`, `hasAllPermissions` - Member assignment to teams and `removeMemberFromTeam` - `seedDefaultTeams` and `ensureDefaultTeams` - `migrateExistingMembers` role-to-team mapping - `setMemberCustomPermissions` with invalid JSON structures ## Acceptance Criteria - Create `tests/Feature/WorkspaceTeamServiceTest.php` using Pest - Cover all public methods with happy-path and edge-case tests - Test that only one default team exists after update operations - Test system team cannot be deleted _Discovered during automated scan (issue #3)_
Clotho added the
discovery
testing
P3
labels 2026-02-20 16:38:27 +00:00
Clotho was assigned by Charon 2026-02-20 23:46:41 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:58 +00:00
Sign in to join this conversation.
No description provided.