Problem
ConvertTo-JiraFilter.Unit.Tests.ps1 covers FilterPermissions, but the fixture and mock setup are easy to misread and previously hid scope-related behavior during the type-system PR4 work.
The converter now needs to prove three distinct paths clearly:
- Explicit
-FilterPermissions input is preferred over payload share permissions.
- Payload
sharePermissions are converted when no explicit filter permissions are supplied.
- Missing permissions produce an empty
AtlassianPS.JiraPS.FilterPermission[] rather than an untyped or scalar value.
Proposal
Refactor the ConvertTo-JiraFilter unit tests so each FilterPermissions scenario has isolated setup and assertions.
Avoid broad mocks that return loosely typed placeholder objects unless the test is explicitly about mock behavior.
Prefer real ConvertTo-JiraFilterPermission output or tightly scoped mocks that assert the input source.
Acceptance criteria
ConvertTo-JiraFilter.Unit.Tests.ps1 has separate examples for explicit -FilterPermissions, payload sharePermissions, and no permissions.
- Each example asserts the resulting
FilterPermissions slot is AtlassianPS.JiraPS.FilterPermission[] with the expected item count and values.
- Tests fail if the converter accidentally ignores explicit permissions, falls back to the wrong source, or returns an untyped array/scalar.
Invoke-Build -Task Build, Test passes.
Related items
Problem
ConvertTo-JiraFilter.Unit.Tests.ps1coversFilterPermissions, but the fixture and mock setup are easy to misread and previously hid scope-related behavior during the type-system PR4 work.The converter now needs to prove three distinct paths clearly:
-FilterPermissionsinput is preferred over payload share permissions.sharePermissionsare converted when no explicit filter permissions are supplied.AtlassianPS.JiraPS.FilterPermission[]rather than an untyped or scalar value.Proposal
Refactor the
ConvertTo-JiraFilterunit tests so each FilterPermissions scenario has isolated setup and assertions.Avoid broad mocks that return loosely typed placeholder objects unless the test is explicitly about mock behavior.
Prefer real
ConvertTo-JiraFilterPermissionoutput or tightly scoped mocks that assert the input source.Acceptance criteria
ConvertTo-JiraFilter.Unit.Tests.ps1has separate examples for explicit-FilterPermissions, payloadsharePermissions, and no permissions.FilterPermissionsslot isAtlassianPS.JiraPS.FilterPermission[]with the expected item count and values.Invoke-Build -Task Build, Testpasses.Related items