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 all tests for DonatorManager Contract #87

Closed
EmmanuelAR opened this issue Sep 25, 2024 · 16 comments · Fixed by #101
Closed

[test] Add all tests for DonatorManager Contract #87

EmmanuelAR opened this issue Sep 25, 2024 · 16 comments · Fixed by #101
Assignees
Labels
good first issue Good for newcomers ODHack8 ODHack8.0 issue

Comments

@EmmanuelAR
Copy link
Collaborator

This issue will be part of ODHack8.0, please apply via Onlydust app

  • Add a test file for the DonatorManager contract. It must test all the methods within the contract, including constructors.
  • It should follow the standard already set by previous tests in the project.
  • The tests should evaluate the success cases of the methods and possible errors in their execution.
  • Knowledge in Cairo and experience with scarb and snforge is recommended.
  • Please read contributors guide before asking for an issue.
@EmmanuelAR EmmanuelAR added good first issue Good for newcomers ODHack8 ODHack8.0 issue labels Sep 25, 2024
@HumbertoTM10
Copy link

Hey @EmmanuelAR, would love to work on it!

My approach would be first to review the DonatorManager contract to understand its methods and constructors, then analyze the existing test files to ensure the new tests follow the project's established standards. I’d set up the environment with scarb and snforge for compiling and testing Cairo contracts. After designing test cases for both success and failure scenarios, I’d write the test file, covering constructors and all methods, ensuring proper state changes and error handling. Finally, I’d run the tests, debug as needed, review for best practices, and submit the tests with proper documentation.

Copy link

onlydustapp bot commented Sep 25, 2024

Hi @HumbertoTM10!
Maintainers during the ODHack # 8.0 will be tracking applications via OnlyDust.
Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

@ShantelPeters
Copy link

Hey @EmmanuelAR I will love to take this up

Copy link

onlydustapp bot commented Sep 25, 2024

Hi @ShantelPeters!
Maintainers during the ODHack # 8.0 will be tracking applications via OnlyDust.
Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

@CollinsC1O
Copy link

@EmmanuelAR I'm a frontend and a blockchain developer. I will love to work on this

Copy link

onlydustapp bot commented Sep 25, 2024

Hi @CollinsC1O!
Maintainers during the ODHack # 8.0 will be tracking applications via OnlyDust.
Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

@MPSxDev
Copy link

MPSxDev commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello, I am Manuel, a process engineer and web3 developer. I have participated in Starknet Bootcamps and am an Elite winner of Speedrunstark. I have a high capacity to solve problems. I am a member of the DojoCoding community.
I hope this issue is assigned to me. I am available to work immediately to achieve what is required in the shortest time possible.

How I plan on tackling this issue

To address the requirements of the issue, I will proceed with the following:

  • Add a dedicated test file for the DonatorManager contract.
  • Write comprehensive tests for all the contract's methods, including constructors.
  • Ensure the tests follow the structure and standard set by the existing test suite in the project.
  • Validate both successful method executions and potential error cases.

@manlikeHB
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi I am cairo dev with lots of experience writing and testing cairo smart contract.

How I plan on tackling this issue

I would write a robust test to cover all edge cases.

@DiegoB1911
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a Full Stack Developer with two years of experience. I'm also an active member of Dojo Coding, where I'm expanding my skills in Cairo and Web3 technologies. I'm eager to learn, contribute, and be part of this project.

How I plan on tackling this issue

To solve this issue, I would:

  1. Create a setup function to deploy the contract and initialize any necessary data.
  2. Write tests to verify that the newDonator function adds new donators correctly and that the getDonatorByAddress function returns the donator's address correctly and also to test the constructor.
  3. Perform a final verification to ensure that the tests are comprehensive and work correctly.
  4. Document the code.

Estimated time to solve it: 2 days

@danielcdz
Copy link
Contributor

danielcdz commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello, I'm Daniel Calderón!
I'm a passionate software engineer with over 3 years of experience, actively contributing to open-source projects through OnlyDust. I’m also a community moderator at Dojo Coding, where I help new developers get started with blockchain development.
Over the past few months, I've contributed to several Starknet projects, including cairo-vm-go by Nethermind. Currently, I’m a Cairo developer at ByteBuilders, working on ByteBeasts, a fully on-chain RPG game built using the Dojo Engine framework.
My expertise spans full-stack development, with a focus on backend, frontend, and smart contract development in blockchain ecosystems.

How I plan on tackling this issue

  • I will implement the required tests by using the starknet::testing utils.
  • By using these utils much of the work to create the test and compare with success cases can be easily done, also by following this path mocks and other utils can be implemented fast and easily.

Estimated time to completion

  • 2 Days

@jimenezz22
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am an active member of the Dojo Coding community in Costa Rica, with experience in Cairo, having built onchain games like ByteBeasts and contributed to open-source projects such as CairoLint, where I implemented tests for Cairo lints. Additionally, I taught Cairo during the Starknet Bootcamp for Dojo Coding. I also have experience with TypeScript, contributing to Starknet Quest by developing components like ComboBoxes, among others.

How I plan on tackling this issue

To tackle this issue, my approach would be:

  1. Review Existing Tests: I will start by reviewing the current test files in the repository to ensure that the new tests I write follow the project’s format and style guidelines.
  2. Understand the DonatorManager Contract: I will thoroughly analyze each method and constructor in the DonatorManager contract. This will allow me to identify the success cases that need testing as well as potential edge cases and error scenarios.
  3. Write Success Case Tests: I will write tests for each method and constructor, verifying that the contract behaves correctly with valid inputs and ideal conditions.
  4. Write Error Case Tests: I will identify possible scenarios where methods might fail, such as invalid inputs or unusual conditions, and write tests to ensure the contract handles these gracefully.
  5. Ensure Compatibility: I will use Scarb and Snforge to run the tests and verify that they pass successfully. I will also ensure that all tests are compatible with the project’s CI setup (GitHub Actions).

Estimated Time to Completion: 3-4 days

@Shoetan
Copy link

Shoetan commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm Emmanuel and I'll be working on issue:

I estimate this will take 2 days to finish
Past contributor to Carbonable where I contributed by writing tests. PR Link carbonable-labs/carbon-protocol-v3#82

How I plan on tackling this issue

This is how I will tackle this issue:
Understand what the donator manager contract does and how it does it.
Create the test file [test-donatorManager.cairo] in the test folder.
Get dispatcher and dispatcherTrait from the contract to access contract functions in the test file.
Write the test following already laid down structure and format.
Make sure I run scarb fmt to format the code properly.
Run the test by running scarb run test as defined in the scarb.toml file.
Response promptly to comments from maintainers.
I will make revision and adjustments based on maintainers' feedback

@mubarak23
Copy link

mubarak23 commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Experience Cairo smart contract developer with experience working on projects such as Just Art Peace, Dojo, Kart, TBA, and Shinigami. Before transitioning to Cairo development, I was a backend developer specializing in Rust.

My recent work with cairo starknet

My recent work with rust

How I plan on tackling this issue

I estimate this will take 18HRS to complete.

This is how I would tackle this issue:

  • Follow the existing setup for the test
    • Test for successful case such as
      • Contract owner is set
      • donator_class_hash is set
      • newDonator is added
    • Test for fail case such as
      • Reading for donor that does not exist
      • Test for the wrong owner
      • Test for the wrong donator_class_hash

ETH: 24HRS

@No-bodyq
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a full stack and block chain dev with experience in writing test for smart contracts in cairo via only dust. Here is my profile: https://app.onlydust.com/u/No-bodyq

How I plan on tackling this issue

I'll begin by reviewing the contributor guide and current test patterns to ensure that the test structure remains consistent. Next, I'll thoroughly examine the DonatorManager contract, listing all its methods and constructors to identify potential success cases as well as possible error conditions. After that, I'll write comprehensive tests for each method, ensuring both successful scenarios and edge cases are properly addressed. Finally, I'll validate the tests using scarb and snforge to ensure they adhere to the project's standards and execute as expected.

@saimeunt
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have multiple experience in Cairo contracts development and testing with snforge:
https://github.com/carbonable-labs/cairo-erc-7498
https://github.com/carbonable-labs/cairo-erc-7496
NethermindEth/StarknetByExample@e287afa

How I plan on tackling this issue

I will carefully add tests to the DonatorManager contract making sure every possible route is taken (aiming for 100% coverage) by asserting that we get the expected results, errors and events emitted along the way.

@ShantelPeters
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i am a blockchain developer and i will love to work on this issue.

How I plan on tackling this issue

To approach this issue, i will follow this steps

  1. Review Existing Tests
  2. Understand the DonatorManager Contract
  3. Set Up a New Test File
  4. Implement Success Case Tests
  5. Implement Error Case Tests
  6. Run the Tests
  7. Document the Tests
  8. Submit for Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers ODHack8 ODHack8.0 issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

14 participants