refactor(Page): add test suite and adapt to manifest schema

This commit is contained in:
Rodweil, Theodor 2023-08-06 22:28:49 +02:00
parent 1cebecaed1
commit 52369d540d
No known key found for this signature in database
GPG key ID: F8BC1B0EB1F9CCF5
3 changed files with 270 additions and 621 deletions

View file

@ -171,24 +171,24 @@ Describe 'Get-PageMeta' `
-Title 'foobar' `
-Space 'foobar' `
-Manifest @{'Pages'= {}}
} | Should -Throw
} | Should -Throw 'more than one result for query*'
}
It 'throws an exception, if there is no result' `
{
Mock Invoke-WebRequest {
Mock -ModuleName 'PageMeta' Invoke-WebRequest {
@{
'Content' = '{"results": []}'
}
}
{
Get-PageMeta `
-Host 'confluence.contoso.com' `
-Title 'foobar' `
-Space 'foobar' `
-Manifest @{'Pages'= {}}
} | Should -Throw
$result = Get-PageMeta `
-Host 'confluence.contoso.com' `
-Title 'foobar' `
-Space 'foobar' `
-Manifest @{'Pages'= {}}
$result | Should -Be $null
}
}
}