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

[test] add new set_goal test #279

Merged
merged 2 commits into from
Nov 29, 2024
Merged

Conversation

renzobanegass
Copy link
Contributor

Pull Request

Changes description

This PR adds a test for the set_goal method in contracts/src/fund.cairo. The new test validates that:

Only authorized addresses (VALID_ADDRESS_1 and VALID_ADDRESS_2) can call the set_goal method to set a new funding goal.
Unauthorized addresses are restricted from calling the method, ensuring the security and integrity of the fund goal-setting functionality.

Current output

  • Before: There was no test validating the new assert logic in the set_goal method.
  • After: The test suite now includes comprehensive coverage for the set_goal method, ensuring only admins can call it and that unauthorized access is properly restricted.

Time spent breakdown

  • Understanding the issue and analyzing requirements: 1 hour
  • Writing and debugging the test cases: 1.5 hours
  • Running and validating the tests: 1 hour (this is still on work, I have an error when running the build)

Comments

This is a draft PR, I have an error when running scarb build/ snforge test related to openzeppelin and starknet dependencies, these are the logs:

image

Also would like to know what's the cli command for formatting the code

@adrianvrj
Copy link
Member

@renzobanegass we use scarb fmt to format the contracts

@adrianvrj adrianvrj marked this pull request as ready for review November 29, 2024 14:55
@adrianvrj
Copy link
Member

@renzobanegass they are running fine!

image

@adrianvrj adrianvrj merged commit f74f934 into web3wagers:dev Nov 29, 2024
4 checks passed
@renzobanegass renzobanegass deleted the test/set-goal branch November 29, 2024 15:00
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.

[test] Add test for new assert in set_goal method
2 participants