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

Add unit tests for the evolution model #92

Open
coxmars opened this issue Nov 20, 2024 · 10 comments · May be fixed by #105
Open

Add unit tests for the evolution model #92

coxmars opened this issue Nov 20, 2024 · 10 comments · May be fixed by #105
Assignees
Labels
external-contributor Available for external contributors good first issue Good for newcomers ODHack10

Comments

@coxmars
Copy link
Contributor

coxmars commented Nov 20, 2024

Start this issue once we have merged the model and functions implemented for the evolution model: #91

  • Add unit tests for all functions implemented for the evolution model:

    • can_evolve
    • evolve

    Or any other additional functions implemented; review the issue and the merged PR for details.

  • Try to add different scenarios for the flow, not just the correct flow, and test several possibilities or edge cases to consider:

    • Invalid inputs (e.g., base_beast_id does not exist, insufficient level or battles won).
    • Evolution blocked due to missing required items.
    • Valid evolution scenarios where all conditions are met.
    • Handling invalid or unexpected states (e.g., empty constants).

Follow the Contributions Guidelines and PR guidelines/example etc.
Include clear comments to explain the test logic and why specific scenarios are covered.

If you need help just ask me here in a comment or ping me on Telegram in the group channel for external contributors.

Thanks for your time, please send a comment with your approach/solution, be creative and use a technical explanation and avoid ChatGPT or AI comments.

@coxmars coxmars added good first issue Good for newcomers external-contributor Available for external contributors ODHack10 labels Nov 20, 2024
@NueloSE
Copy link

NueloSE commented Nov 21, 2024

I'd love to work on this!

i have experience writing and testing smart contracts kindly assign me

@CollinsC1O
Copy link

Hello @coxmars may I take care of this?

@petersdt
Copy link

Can I take this issue?

i have some experience in testing smart contracts in cairo kindly assign me

@manlikeHB
Copy link

Hi, I am a Cairo developer with great experience contributing to lots of Cairo projects.

I will write a robust test that covers all edge cases and ensures the expected behaviors.

May I pick this up?

@ShantelPeters
Copy link

I’d love to work on this task.

@Michaelkingsdev
Copy link

Could I take on this issue?

@martinvibes
Copy link

Can I take care of this issue?
i'm a frontend dev, and a blockchain dev kindly assign :)

@zkCaleb-dev
Copy link

Hello, my name is Caleb, and I would like to apply for this issue.

I have solid experience programming with Rust on the Stellar network, having developed and deployed various smart contracts and blockchain solutions. Additionally, I’ve conducted extensive unit testing for multiple projects, ensuring the functionality and reliability of my code.

Given my experience with both Rust and Stellar, I’m confident in my ability to effectively address and resolve this issue. I’m excited about the opportunity to contribute and demonstrate my skills.

@coxmars
Copy link
Contributor Author

coxmars commented Nov 21, 2024

Hello, my name is Caleb, and I would like to apply for this issue.

I have solid experience programming with Rust on the Stellar network, having developed and deployed various smart contracts and blockchain solutions. Additionally, I’ve conducted extensive unit testing for multiple projects, ensuring the functionality and reliability of my code.

Given my experience with both Rust and Stellar, I’m confident in my ability to effectively address and resolve this issue. I’m excited about the opportunity to contribute and demonstrate my skills.

Hi @zkCaleb-dev, if you need help or guidance just ask me 🫡

@JoelVR17
Copy link

JoelVR17 commented Dec 1, 2024

Application for Issue: Add Unit Tests for Evolution Model Functions

Approach

To address the issue, I will design unit tests for the following functions:

  • can_evolve: Ensure it accurately determines if evolution is possible based on predefined conditions.
  • evolve: Verify it handles the evolution process correctly.

Test Scenarios

The tests will cover a variety of flows, including edge cases, invalid inputs, and valid conditions. Specifically:

  1. Invalid Inputs:

    • base_beast_id does not exist.
    • Beast does not meet the required level or number of battles won.
  2. Blocked Evolution:

    • Missing required evolution items.
    • Incorrect prerequisites (e.g., incomplete evolution chain).
  3. Valid Evolution:

    • All conditions met, ensuring the function transitions the beast to its evolved state correctly.
  4. Handling Unexpected States:

    • Empty or undefined constants (e.g., evolution conditions not defined).
    • Null or corrupted inputs.

Methodology

  • Test Cases:

    • Utilize mocks or stubs to simulate edge cases and isolate the function logic.
    • Ensure boundary values (e.g., minimum level, exact number of battles) are tested.
    • Add assertions to verify state changes before and after function execution.
  • Documentation:

    • Include clear comments explaining the logic behind each test and the scenario it covers.
    • Use descriptive naming conventions for tests to improve readability.
  • Tooling:

    • Use the testing framework recommended in the project (e.g., Jest, Mocha) for consistency.
    • Leverage any pre-configured utilities or testing helpers available in the codebase.

Contributions Guidelines

I will strictly adhere to the project's Contribution and PR Guidelines:

  • Include descriptive commit messages and a detailed PR description.
  • Structure test files according to the existing folder hierarchy.

Request for Support

If any clarifications are needed regarding the functions or their implementation, I will reach out either through this issue or Telegram.

Thank you for considering my application. I aim to provide robust and well-documented tests to enhance the project's reliability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-contributor Available for external contributors good first issue Good for newcomers ODHack10
Projects
Status: TODO 🥷
10 participants