Skip to content
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

Fix tests #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jacqueline-57b
Copy link
Contributor

@jacqueline-57b jacqueline-57b commented Jul 15, 2024

This PR is to fix the test scripts as the IP asset is default attached non-commercial PIL.

Summary by CodeRabbit

  • Bug Fixes

    • Updated error messages for raising and resolving disputes to improve clarity.
  • Refactor

    • Modified test cases to use updated license terms and error messages for better accuracy.
    • Adjusted import statements and removed unused imports for cleaner code.
  • Style

    • Added semicolons to the end of import statements across multiple test files for consistency.
  • Chores

    • Updated @story-protocol/core-sdk dependency from 1.0.0-rc.14 to 1.0.0-rc.15.

Copy link

coderabbitai bot commented Jul 15, 2024

Walkthrough

The recent updates primarily focused on refining test files and dependencies. Error messages were clarified, and import statements were streamlined with added semicolons. Additionally, some test cases were modified to enhance clarity and accuracy. The package.json file saw a minor version update for the @story-protocol/core-sdk. These changes aim to improve the overall testing infrastructure and code readability without altering the functionality of exported or public entities.

Changes

Files Change Summaries
package.json Updated dependency @story-protocol/core-sdk from 1.0.0-rc.14 to 1.0.0-rc.15.
test/dispute/raiseDispute.test.ts Updated error messages for invalid addresses or non-existent data scenarios.
test/dispute/resolveDispute.test.ts Modified error messages from "Failed to cancel dispute" to "Failed to resolve dispute" for various scenarios.
Multiple test/e2e/... files Added semicolons to import statements and adjusted test steps for attaching license terms.
test/e2e/licenseTerms.nonComPIL.test.ts Replaced registerIpAndAttachPilTerms with registerIpAsset and updated associated logic.
test/e2e/multiLIcenseTerms.test.ts Added semicolons to imports and replaced nonComLicenseTermsId with 0n in registerDerivative function.
test/e2e/royalty.comRemixPIL.test.ts Updated import statements, removed unused imports, and adjusted function imports.
test/e2e/setPermissions.test.ts Modified import statements and test steps to use 0n instead of nonComLicenseTermsId.
test/ipAccount/executeWithSig.test.ts Added a semicolon at the end of an import statement.
test/ipAsset/mintAndRegisterIpAssetWithPilTerms.test.ts Adjusted license terms, added optional parameters, and updated error handling assertions.

Poem

In the world of tests, where bugs take flight,
We sharpen our code, making errors contrite.
With semicolons and messages clear,
Each test now runs without a sneer.
Dependencies bumped, no more disputes to fear,
Celebrate the code, for the changes are here!
🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a69b1d6 and 1992208.

Files selected for processing (24)
  • package.json (1 hunks)
  • test/dispute/raiseDispute.test.ts (1 hunks)
  • test/dispute/resolveDispute.test.ts (2 hunks)
  • test/e2e/derivativeIP.comUsePIL.test.ts (1 hunks)
  • test/e2e/derivativeIP.nonComPIL.test.ts (11 hunks)
  • test/e2e/dispute.test.ts (4 hunks)
  • test/e2e/licenseTerms.nonComPIL.test.ts (2 hunks)
  • test/e2e/multiLIcenseTerms.test.ts (3 hunks)
  • test/e2e/royalty.comRemixPIL.test.ts (1 hunks)
  • test/e2e/royalty.comUsePIL.test.ts (1 hunks)
  • test/e2e/setPermissions.test.ts (4 hunks)
  • test/ipAccount/executeWithSig.test.ts (1 hunks)
  • test/ipAsset/mintAndRegisterIpAssetWithPilTerms.test.ts (3 hunks)
  • test/ipAsset/register.test.ts (1 hunks)
  • test/ipAsset/registerDerivative.test.ts (2 hunks)
  • test/ipAsset/registerDerivativeIp.test.ts (2 hunks)
  • test/ipAsset/registerDerivativeWithLicenseTokens.test.ts (3 hunks)
  • test/ipAsset/registerIpAndAttachPilTerms.test.ts (4 hunks)
  • test/license/attachLicenseTerms.test.ts (4 hunks)
  • test/license/mintLicenseTokens.test.ts (3 hunks)
  • test/nftClient/createNFTCollection.test.ts (2 hunks)
  • test/permission/permission.test.ts (1 hunks)
  • test/royalty/payRoyaltyOnBehalf.test.ts (1 hunks)
  • test/testUtils.ts (1 hunks)
Files skipped from review due to trivial changes (13)
  • package.json
  • test/dispute/raiseDispute.test.ts
  • test/e2e/derivativeIP.comUsePIL.test.ts
  • test/e2e/derivativeIP.nonComPIL.test.ts
  • test/e2e/multiLIcenseTerms.test.ts
  • test/e2e/royalty.comRemixPIL.test.ts
  • test/e2e/royalty.comUsePIL.test.ts
  • test/ipAccount/executeWithSig.test.ts
  • test/ipAsset/register.test.ts
  • test/ipAsset/registerDerivativeIp.test.ts
  • test/nftClient/createNFTCollection.test.ts
  • test/royalty/payRoyaltyOnBehalf.test.ts
  • test/testUtils.ts
Additional comments not posted (33)
test/dispute/resolveDispute.test.ts (8)

54-54: LGTM!

The updated error message provides clear information about the failure.


60-60: LGTM!

The updated error message provides clear information about the failure.


66-67: LGTM!

The updated error message provides clear information about the failure.


74-74: LGTM!

The updated error message provides clear information about the failure.


80-81: LGTM!

The updated error message provides clear information about the failure.


87-88: LGTM!

The updated error message provides clear information about the failure.


97-98: LGTM!

The updated error message provides clear information about the failure.


104-105: LGTM!

The updated error message provides clear information about the failure.

test/e2e/licenseTerms.nonComPIL.test.ts (3)

2-2: LGTM! Import statement updated correctly.

The import statement for registerIpAndAttachPilTerms has been replaced with registerIpAsset, which aligns with the function usage in the code.


114-123: LGTM! Function usage updated correctly.

The function registerIpAndAttachPilTerms has been replaced with registerIpAsset, which aligns with the updated import statement and the intended functionality.


Line range hint 195-195:
LGTM! Parameter updated correctly.

The parameter nonComLicenseTermsId has been replaced with 0n, which aligns with the standardized handling of license terms in the code.

test/ipAsset/mintAndRegisterIpAssetWithPilTerms.test.ts (2)

93-93: LGTM! Parameters updated correctly.

The parameters of the mintAndRegisterIpAssetWithPilTerms function have been updated to include additional optional parameters, which aligns with the intended functionality and test coverage.


130-133: LGTM! Parameters updated correctly.

The parameters of the mintAndRegisterIpAssetWithPilTerms function have been updated to include additional optional parameters, which aligns with the intended functionality and test coverage.

test/ipAsset/registerDerivativeWithLicenseTokens.test.ts (2)

4-4: LGTM! Import statement updated correctly.

The import statement for registerIpAndAttachPilTerms has been replaced with registerIpAsset, which aligns with the function usage in the code.


203-203: LGTM! Parameters updated correctly.

The parameters of the registerDerivativeWithLicenseTokens function have been updated to include additional optional parameters, which aligns with the intended functionality and test coverage.

test/license/attachLicenseTerms.test.ts (1)

114-117: LGTM! Parameters updated correctly.

The parameters of the attachLicenseTerms function have been updated to include additional optional parameters, which aligns with the intended functionality and test coverage.

test/license/mintLicenseTokens.test.ts (2)

101-102: LGTM! Error message update is correct.

The updated error message accurately reflects the correct license terms ID.


176-186: LGTM! New test case adds valuable coverage.

The new test case enhances the test coverage by verifying the minting of license tokens with multiple license terms attached to an IP asset.

test/ipAsset/registerIpAndAttachPilTerms.test.ts (2)

129-129: LGTM! Error message update is correct.

The updated error message accurately reflects the correct size of the bytes.


138-138: LGTM! Error message update is correct.

The updated error message accurately reflects the correct function signature.

test/e2e/dispute.test.ts (4)

62-62: LGTM! Error message update is correct.

The updated error message accurately reflects the correct license terms ID.


290-290: LGTM! Error message update is correct.

The updated error message accurately reflects the correct function signature.


312-322: LGTM! Error message update is correct.

The updated error message accurately reflects the correct function signature.


383-383: LGTM! Error message update is correct.

The updated error message accurately reflects the correct function signature.

test/e2e/setPermissions.test.ts (5)

7-7: LGTM! Import statement is correctly added.

The import statement for comUseLicenseTermsId1 is correctly added to support the test steps.


65-67: LGTM!

The step correctly updates the test to use the new license terms ID 0n and checks for a successful transaction.


112-114: LGTM!

The step correctly updates the test to use the new license terms ID 0n and checks for a successful transaction.


49-51: LGTM! But verify the error message consistency.

The step correctly updates the test to use the new license terms ID 0n and improves error message clarity.

However, ensure that the error message "Failed to attach license terms: The contract function \"attachLicenseTerms\" reverted with the following signature:" is consistent across the codebase.

Verification successful

Let's modify the script to search for the error message across all files without specifying a file type.


Verified: Error message consistency

The error message "Failed to attach license terms: The contract function "attachLicenseTerms" reverted with the following signature:" is used consistently in the codebase.

  • test/e2e/licenseTerms.nonComPIL.test.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the error message consistency across the codebase.

# Test: Search for the error message. Expect: Consistent usage.
rg --type javascript -A 5 $'Failed to attach license terms: The contract function "attachLicenseTerms" reverted with the following signature:'

Length of output: 178


Script:

#!/bin/bash
# Description: Verify the error message consistency across the codebase.

# Test: Search for the error message. Expect: Consistent usage.
rg -A 5 $'Failed to attach license terms: The contract function "attachLicenseTerms" reverted with the following signature:'

Length of output: 612


75-77: LGTM! But verify the error message consistency.

The step correctly updates the test to use the new license terms ID 0n and improves error message clarity.

However, ensure that the error message "Failed to attach license terms: The contract function \"attachLicenseTerms\" reverted with the following signature:" is consistent across the codebase.

Verification successful

The error message is consistent across the codebase.

The error message "Failed to attach license terms: The contract function \"attachLicenseTerms\" reverted with the following signature:" is used consistently in the codebase, as found in test/e2e/licenseTerms.nonComPIL.test.ts.

  • test/e2e/licenseTerms.nonComPIL.test.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the error message consistency across the codebase.

# Test: Search for the error message. Expect: Consistent usage.
rg --type javascript -A 5 $'Failed to attach license terms: The contract function "attachLicenseTerms" reverted with the following signature:'

Length of output: 178


Script:

#!/bin/bash
# Description: Verify the error message consistency across the codebase.

# Test: Search for the error message. Expect: Consistent usage.
rg -A 5 $'Failed to attach license terms: The contract function "attachLicenseTerms" reverted with the following signature:'

Length of output: 612

test/ipAsset/registerDerivative.test.ts (4)

4-4: LGTM! Import statement is correctly added.

The import statement for expect from chai is correctly added to support the test steps.


55-55: LGTM!

The step correctly updates the test to use the new license terms ID 0n and checks for a successful transaction.


49-50: LGTM! But verify the error message consistency.

The step correctly updates the test to use the new license terms ID 0n and improves error message clarity.

However, ensure that the error message "Failed to register derivative: License terms id 0 must be attached to the parent ipId" is consistent across the codebase.

Verification successful

The error message is consistent across the codebase.

The error message "Failed to register derivative: License terms id 0 must be attached to the parent ipId" appears consistently in the following test files:

  • test/ipAsset/registerDerivative.test.ts
  • test/e2e/multiLIcenseTerms.test.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the error message consistency across the codebase.

# Test: Search for the error message. Expect: Consistent usage.
rg --type javascript -A 5 $'Failed to register derivative: License terms id 0 must be attached to the parent ipId'

Length of output: 150


Script:

#!/bin/bash
# Description: Verify the error message consistency across the codebase.

# Test: Search for the error message. Expect: Consistent usage.
rg 'Failed to register derivative: License terms id 0 must be attached to the parent ipId' --glob '*.js' -A 5

Length of output: 260


Script:

#!/bin/bash
# Description: Verify the error message consistency across the codebase.

# Test: Search for the error message. Expect: Consistent usage.
rg 'Failed to register derivative: License terms id 0 must be attached to the parent ipId' -A 5

Length of output: 1443


60-60: LGTM! But verify the error message consistency.

The step correctly updates the test to use the new license terms ID 0n and improves error message clarity.

However, ensure that the error message "Failed to register derivative: The contract function \"registerDerivative\" reverted with the following signature:" is consistent across the codebase.

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.

1 participant