Skip to content

fix tests #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2025
Merged

fix tests #19

merged 5 commits into from
Apr 15, 2025

Conversation

MarkSackerberg
Copy link
Collaborator

Fixing the tests that are somehow failing now after merging to main

Copy link

vercel bot commented Apr 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
digital-asset-standard-api-js-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 8, 2025 2:52pm

Copy link
Contributor

coderabbitai bot commented Apr 8, 2025

Summary by CodeRabbit

  • Tests
    • Refined asset verification to use flexible checks for asset identification.
    • Updated collection metadata validations to reflect new collection details, including a revised name, image, and description.
    • Strengthened criteria for asset grouping tests to ensure more precise matching.
    • Adjusted creator, authority, and owner configurations in tests for consistency with the updated specifications.

Walkthrough

This pull request updates several JavaScript test files related to asset retrieval. The changes modify assertion logic by replacing direct equality checks with existence checks for asset IDs and by refining how collection metadata is verified. Expected values for collection metadata—such as the collection name, image URL, description, and group value—have been updated. Additionally, hardcoded public key values used in group-related tests have been replaced with new keys. No changes were made to exported or public entities.

Changes

File(s) Change Summary
clients/js/test/getAssets.test.ts, clients/js/test/getAssetsByCreator.test.ts, clients/js/test/getAssetsByOwner.test.ts Updated assertions for validating asset IDs and collection metadata. Changed checks from strict equality to verifying existence, and updated expected metadata values including group_value, collection name ("Chiaki Azure 55 Collection"), image URL, and description.
clients/js/test/getAssetsByAuthority.test.ts Modified the logic for detecting collection metadata by checking for a specific group_value instead of merely verifying the presence of a non-empty grouping array.
clients/js/test/getAssetsByGroup.test.ts Replaced a hardcoded public key string with a new key for tests fetching assets by group.

Suggested reviewers

  • nhanphan
  • brandontulsi
  • devonbeard
  • blockiosaurus
  • danenbm

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c1adae and ab28cb8.

📒 Files selected for processing (5)
  • clients/js/test/getAssets.test.ts (2 hunks)
  • clients/js/test/getAssetsByAuthority.test.ts (1 hunks)
  • clients/js/test/getAssetsByCreator.test.ts (3 hunks)
  • clients/js/test/getAssetsByGroup.test.ts (1 hunks)
  • clients/js/test/getAssetsByOwner.test.ts (2 hunks)
🔇 Additional comments (11)
clients/js/test/getAssetsByGroup.test.ts (1)

12-12: Public key updated for group value test fixtures

The public key for groupValue has been updated to '5g2h8NuNNdb2riSuAKC3JJrrJKGJUH9dxM23fqdYgGt2'. This change appears to be part of the effort to fix failing tests by using a key that exists in the current test environment.

clients/js/test/getAssetsByAuthority.test.ts (1)

112-116: Improved test specificity for collection metadata checks

The collection metadata search has been improved to look for a specific group_value ('Ce9hnNkbwNP7URw6TkhpopcKeNm8s4SchbBJS3m8tTu2') rather than just checking for the existence of any grouping. This makes the test more precise and reliable.

clients/js/test/getAssetsByOwner.test.ts (3)

65-65: Owner public key updated for test fixtures

The owner public key has been updated to 'DAS7Wnf86QNmwKWacTe8KShU7V6iw7wwcPjG9qXLPkEU', aligning with the fix for failing tests by using a key that exists in the current test environment.


88-95: Improved test specificity with targetCollectionValue

Good improvement by introducing a constant for the target collection value and updating the asset search logic to check for both the correct group_key and the specific group_value. This makes the test more robust and precise.


102-114: Refined collection grouping verification

The collection grouping verification has been improved to specifically check for the target collection value, making the test more deterministic and less prone to false positives.

clients/js/test/getAssetsByCreator.test.ts (3)

138-138: Creator public key updated for test fixtures

The creator public key has been updated to 'DAS7Wnf86QNmwKWacTe8KShU7V6iw7wwcPjG9qXLPkEU', aligning with the fix for failing tests by using a key that exists in the current test environment.


160-164: Improved test specificity for collection asset search

The collection asset search logic has been enhanced to check for both the correct group_key and a specific group_value, making the test more precise and reliable.


178-186: Updated expected collection metadata values

The expected collection metadata values have been updated to match the current test environment:

  • Collection group value: 'Ce9hnNkbwNP7URw6TkhpopcKeNm8s4SchbBJS3m8tTu2'
  • Collection name: 'Chiaki Azure 55 Collection'
  • Image URL: Updated to a new Arweave URL
  • Added detailed description about the MONMONMON collection

These changes ensure the tests correctly match the metadata available in the test environment.

clients/js/test/getAssets.test.ts (3)

124-124: Good change for test robustness

The switch from a direct index access to assets.some() makes the test more resilient to changes in the order of returned assets. This prevents test failures that could occur if the API returns the assets in a different order than expected, which aligns with the PR objective of fixing failing tests.


127-129: Improved reliability for asset selection logic

The updated condition to find an asset with collection metadata is more precise and reliable. By directly checking for a specific asset ID rather than relying on the presence of collection metadata in a specific array position, the test becomes more resilient to changes in the API response structure.


137-146: Updated collection metadata values

The changes to the expected collection metadata values (group_value, name, image URL, and description) correctly align the test with the current API response structure. This addresses the failing tests mentioned in the PR objectives.

The detailed description now properly reflects the MONMONMON collection information, and the other fields have been updated to match the actual values returned by the API.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MarkSackerberg MarkSackerberg marked this pull request as ready for review April 9, 2025 12:45
@metaplex-foundation metaplex-foundation deleted a comment from coderabbitai bot Apr 9, 2025
@MarkSackerberg MarkSackerberg merged commit 6aa794d into main Apr 15, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants