Skip to content

Conversation

@fasteiner
Copy link
Owner

Summary

  • add a Pester suite for New-NotionBlock covering representative parameter sets
  • recreate block-specific unit tests under folders that mirror the Public/Block structure and verify block-specific properties
  • add rich text unit coverage for New-NotionRichText and New-NotionRichTextAnnotation

Testing

  • attempted ./build.ps1 -Tasks test -AutoRestore (fails: pwsh not available in container)

https://chatgpt.com/codex/tasks/task_e_68d54c277e6c8322880c72b8631cde17

@fasteiner fasteiner marked this pull request as ready for review September 25, 2025 16:59
@fasteiner fasteiner merged commit b847538 into feature/36-pester-tests-for-block-functions Sep 25, 2025
1 check failed
@fasteiner fasteiner deleted the codex/add-pester-tests-for-new-commands branch September 25, 2025 17:01
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +22 to +27
It "Should create an empty bookmark block" {
$result = New-NotionBookmarkBlock

$result | Should -BeOfType "notion_bookmark_block"
$result.type | Should -Be ([notion_blocktype]::bookmark)
$result.bookmark.url | Should -BeNullOrEmpty

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Avoid null dereference when asserting empty bookmark block

The new test dereferences bookmark.url on a bookmark block created without parameters. New-NotionBookmarkBlock returns [notion_bookmark_block]::new() in this case and the class’s default constructor leaves the bookmark member uninitialized, so $result.bookmark is $null. Accessing .url will raise an InvokeMethodOnNull error before the Should -BeNullOrEmpty assertion is evaluated, causing the suite to fail even when the command behaves correctly. Consider asserting on $result.bookmark itself or initializing the bookmark structure in the cmdlet instead of dereferencing a possibly-null property.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant