@@ -40,16 +40,16 @@ Describe "Get-BloggerPost" {
4040
4141 # setup blog post retrieval
4242 Mock Invoke-GAPi {
43- return [pscustomobject ]@ { content = " <html >Test content</html >" }
43+ return [pscustomobject ]@ { content = " <p >Test content</p >" }
4444 }
4545 }
4646
4747 # act
48- $result = Get-BloggerPost - PostId " 123" - Format HTML - OutDirectory $OutDirectory
48+ Get-BloggerPost - PostId " 123" - Format HTML - OutDirectory $OutDirectory
4949
5050 # assert
51- $result | Should -Not - BeNullOrEmpty
52- Test-Path - Path ( Join-Path - Path $OutDirectory - ChildPath " 123.html " ) | Should - BeTrue
51+ $outputFile = Join-Path - Path $OutDirectory - ChildPath " 123.html "
52+ Test-Path - Path $outputFile | Should - BeTrue
5353 }
5454 }
5555
@@ -64,7 +64,7 @@ Describe "Get-BloggerPost" {
6464 It " Should call correct API endpoint" {
6565 InModuleScope PSBlogger {
6666 Mock Invoke-GApi {
67- return [pscustomobject ]@ { content = " <html >Test content</html >" }
67+ return [pscustomobject ]@ { content = " <p >Test content</p >" }
6868 } - ParameterFilter {
6969 $uri -eq " https://www.googleapis.com/blogger/v3/blogs/test-blog-id/posts/123"
7070 } - Verifiable
@@ -131,7 +131,7 @@ Describe "Get-BloggerPost" {
131131
132132 # mock post retrieval
133133 Mock Invoke-GApi {
134- return @ { content = " <html >Test content</html >" }
134+ return @ { content = " <p >Test content</p >" }
135135 }
136136 }
137137 }
@@ -367,4 +367,45 @@ Describe "Get-BloggerPost" {
367367 Test-Path " TestDrive:\123.html" | Should - BeTrue
368368 }
369369 }
370+
371+ Context " PassThru" {
372+
373+ BeforeEach {
374+ InModuleScope PSBlogger {
375+ # Mock the session to return a test blog ID
376+ $BloggerSession.BlogId = " test-blog-id"
377+
378+ # mock post retrieval
379+ Mock Invoke-GApi {
380+ return @ { content = " <p>Test content</p>" }
381+ }
382+ }
383+ }
384+
385+ It " Should return post object when not persisting output to disk" {
386+ # act
387+ $result = Get-BloggerPost - PostId " 123"
388+
389+ # assert
390+ $result | Should -Not - BeNullOrEmpty
391+ }
392+
393+ It " Should not return a post object when persisting to disk" {
394+ # act
395+ $result = Get-BloggerPost - PostId " 123" - Format HTML - OutDirectory TestDrive:\
396+
397+ # assert
398+ $result | Should - BeNullOrEmpty
399+ }
400+
401+ It " Should return post object when persisting to disk with PassThru specified" {
402+ # act
403+ $result = Get-BloggerPost - PostId " 123" - Format HTML - OutDirectory TestDrive:\ - PassThru
404+
405+ # assert
406+ $result | Should -Not - BeNullOrEmpty
407+ }
408+
409+
410+ }
370411}
0 commit comments