Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion Test/public/project_item.searchprojectitem.test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,26 @@ function Test_SearchProjectItem_AND_Filter_SUCCESS {
# Negative: second token missing
$notFound = Search-ProjectItem -Owner $Owner -ProjectNumber $ProjectNumber -Filter "UniqueSearchAlpha","MissingZeta"
Assert-Count -Expected 0 -Presented $notFound
}
}

function Test_StubShowProjectInbox_SUCCESS {

# Arrange
Reset-InvokeCommandMock
$p = Get-Mock_Project_700
$owner = $p.owner
$projectNumber = $p.number
MockCall_GetProject_700
$expected = @($p.items.values | Where-Object { [string]::IsNullOrWhiteSpace($_.Status) })

# Act
$result = Stub_ShowProjectInbox -Owner $owner -ProjectNumber $projectNumber -PassThru

# Assert
$itemsWithStatus = @($result | Where-Object { -not [string]::IsNullOrWhiteSpace($_.Status) })
Assert-Count -Expected $expected.Count -Presented $result
Assert-Count -Expected 0 -Presented $itemsWithStatus
foreach($id in $expected.id){
Assert-Contains -Expected $id -Presented $result.id
}
}
21 changes: 21 additions & 0 deletions public/items/project_item.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,27 @@ function Search-ProjectItem {

} Export-ModuleMember -Function Search-ProjectItem -Alias "spi"

function Stub_ShowProjectInbox{
[CmdletBinding()]
param(
[Parameter()][string]$Owner,
[Parameter()][string]$ProjectNumber,
[Parameter()][switch]$PassThru
)

($Owner, $ProjectNumber) = Resolve-ProjectParameters -Owner $Owner -ProjectNumber $ProjectNumber

$items = Search-ProjectItem -Owner $Owner -ProjectNumber $ProjectNumber -IncludeDone -PassThru
$items = @($items | Where-Object { [string]::IsNullOrWhiteSpace($_.Status) })

if($PassThru){
return $items
}

return $items | Use-Order

} Export-ModuleMember -Function Stub_ShowProjectInbox

function Format-ProjectItem{
[CmdletBinding()]
[Alias("fpi")]
Expand Down