@@ -184,6 +184,7 @@ Describe "Get-BloggerPost" {
184184 title = " Test Post"
185185 published = [datetime ]" 2023-10-01T17:30:00-04:00"
186186 content = " <h1>Hello World</h1><p>This is a post.</p>"
187+ labels = @ (" Azure DevOps" , " Azure Pipelines" )
187188 }
188189 }
189190 }
@@ -200,7 +201,7 @@ Describe "Get-BloggerPost" {
200201 }
201202 }
202203
203- It " Should write post details to frontmatter" {
204+ It " Should write postid to frontmatter" {
204205
205206 # act
206207 Get-BloggerPost - PostId $postId - Format Markdown - OutDirectory " TestDrive:\"
@@ -209,6 +210,44 @@ Describe "Get-BloggerPost" {
209210 $frontMatter = Get-MarkdownFrontMatter - File $outFile
210211 $frontMatter.postId | Should - Be " 123"
211212 }
213+
214+ It " Should write labels to frontmatter" {
215+ # act
216+ Get-BloggerPost - PostId $postId - Format Markdown - OutDirectory " TestDrive:\"
217+
218+ # assert
219+ $frontMatter = Get-MarkdownFrontMatter - File $outFile
220+ $frontMatter.tags.Count | Should - Be 2
221+ $frontMatter.tags [0 ] | Should - Be " Azure DevOps"
222+ $frontMatter.tags [1 ] | Should - Be " Azure Pipelines"
223+ }
224+
225+ It " Should include empty tags in frontmatter if labels are not present" {
226+ # arrange
227+ InModuleScope PSBlogger {
228+ # Mock the session to return a test blog ID
229+ $BloggerSession.BlogId = " test-blog-id"
230+
231+ $postId = " 123"
232+
233+ # mock post retrieval
234+ Mock Invoke-GApi {
235+ return @ {
236+ id = $postId
237+ title = " Test Post"
238+ published = [datetime ]" 2023-10-01T17:30:00-04:00"
239+ content = " <h1>Hello World</h1><p>This is a post.</p>"
240+ }
241+ }
242+ }
243+ # act
244+ Get-BloggerPost - PostId $postId - Format Markdown - OutDirectory " TestDrive:\"
245+
246+ # assert
247+ $frontMatter = Get-MarkdownFrontMatter - File $outFile
248+ $frontMatter [' tags' ] -eq $null | Should - BeFalse
249+ $frontMatter [' tags' ] | Should - Be @ ()
250+ }
212251 }
213252
214253 Context " As Json" {
@@ -280,6 +319,7 @@ Describe "Get-BloggerPost" {
280319 It " Should write file to specified formatted directory - <dateformat> - <format>" - TestCases @ (
281320 @ { DateFormat = " yyyy\\MM" ; ExpectedPath = " TestDrive:\2023\10\Test Post.md" ; Format = " Markdown" }
282321 @ { DateFormat = " yyyy\\MM\\dd" ; ExpectedPath = " TestDrive:\2023\10\01\123.html" ; Format = " HTML" }
322+ @ { DateFormat = " yyyy" ; ExpectedPath = " TestDrive:\2023\123.json" ; Format = " JSON" }
283323 ) {
284324 # arrange
285325 $invokeArgs = @ {
0 commit comments