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 Failing Tests related to the create_new_player() #188

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

Jagadeeshftw
Copy link
Contributor

@Jagadeeshftw Jagadeeshftw commented Jan 10, 2025

Description

The failure was due to using set_caller_address, which only sets the address for the current contract. Since these tests involve calling an external contract (game_action_system), the appropriate function to set the address is set_contract_address.

Related Issue(s)

Closes #185

Checklist:

  • Read the contributing docs (if this is your first contribution)

  • Verified this is not a duplicate of any existing pull request

  • Performed a self-review of the code

  • Rebased to the last commit of the target branch (or merged it into my branch)

  • Linked the issues which this PR resolves

  • Documented the changes in code (API docs will be generated automatically)

Copy link

co-lead bot commented Jan 10, 2025

Thanks for your PR @Jagadeeshftw. It will be reviewed shortly.

@Jagadeeshftw
Copy link
Contributor Author

While testing for the USERNAME ALREADY CREATED error, it is important to use two different usernames for the same caller. If the same username is used for both calls, the error will be caught earlier by the USERNAME ALREADY TAKEN check, and the test will not cover the intended error scenario.

@0xibs
Copy link
Collaborator

0xibs commented Jan 10, 2025

While testing for the USERNAME ALREADY CREATED error, it is important to use two different usernames for the same caller. If the same username is used for both calls, the error will be caught earlier by the USERNAME ALREADY TAKEN check, and the test will not cover the intended error scenario.

The aim of panicking with USERNAME_ALREADY_CREATED error is to prevent players who have created their usernames from creating another username or updating the created username. While USERNAME ALREADY TAKEN is for new players who have not created username before and tries to create one that has already been taken

@0xibs 0xibs merged commit 356c5b0 into sivicstudio:dev Jan 10, 2025
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.

Fix and complete test for create_new_player() function
2 participants