stellar / basic-payment-app

An example payments application demonstrating integrations of various features and SEPs in a user-facing product.
https://github.com/stellar/basic-payment-app
Apache License 2.0
9 stars 27 forks source link

Add unit tests #13

Closed ElliotFriend closed 1 week ago

ElliotFriend commented 1 month ago

This project has no tests written for it. That should be rectified. When creating a new SvelteKit project, you can optionally create structure for integration tests using playwright or unit tests using vitest. So, those seem like decent options for us to use here.

Unit tests should be written for probably all the functions we have written in /src/lib/stellar/* and /src/lib/utils.js, but there might be more places where that's appropriate, as well.

martinvibes commented 1 month ago

can i work on this @ElliotFriend

onlydustapp[bot] commented 1 month ago

Hi @martinvibes! 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.

jimenezz22 commented 1 month ago

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

Approach for the Issue:

Set Up Unit Testing Framework:

I will review all the functions located in /src/lib/stellar/* and /src/lib/utils.js to identify the critical areas that require unit tests. Additional functions across the codebase will also be evaluated to ensure comprehensive test coverage. Write Unit Tests:

For each function, I will write unit tests that cover: Success Cases: Ensure that each function behaves as expected with valid inputs. Edge Cases: Identify and write tests for potential edge cases or boundary conditions. Error Handling: Test how each function handles invalid inputs or exceptions. Mocking and Dependencies:

Where necessary, I will mock external dependencies or API calls to isolate the behavior of individual functions during testing. Run and Validate Tests:

I will ensure that all tests run successfully, verifying that each function performs as expected and that the codebase is now covered with unit tests. Estimated Time to Completion: 2-3 days, depending on the number of functions and complexity.

gregemax commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

"Experienced in JavaScript with a focus on Vitest and Playwright for testing. I've writing tests to ensure code quality and reliability

How I plan on tackling this issue

I would set up Vitest for unit tests and Playwright for integration tests, focusing first on key functions in /src/lib/stellar/* and /src/lib/utils.js. Then, I’d ensure comprehensive coverage by gradually expanding tests across the project.

mariocodecr commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hii! My name is Mario Araya, I’m a Software Developer with 2+ years of experience. I have worked with backend technologies such as Cairo, Java, and C#, as well as frontend development using React, NextJS, and JavaScript/TypeScript. I’ve made contributions to open-source projects, completed a Starknet Bootcamp, exercises on NodeGuardians, finished Starklings, and participated in multiple hackathons. I’m also a member of the Dojo Coding community here in Costa Rica.

How I plan on tackling this issue

I would approach this issue by first setting up either Playwright for integration tests or Vitest for unit tests, as these frameworks will provide a solid foundation for testing. I would identify all functions in /src/lib/stellar/* and /src/lib/utils.js to write comprehensive unit tests, ensuring to cover normal cases, edge cases, and error handling. Additionally, I would review other areas in the codebase for potential testing opportunities, such as complex components or services. After implementing the tests, I would run them to ensure they pass and check for coverage reports to identify untested areas. If necessary, I would also integrate Playwright for broader integration testing to ensure overall application functionality. Throughout this process, I would consult documentation for best practices and seek feedback from maintainers for any improvements.

Ugo-X commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Full Stack blockchain Developer with expertise in Next.js, Nest.js, TypeScript, JavaScript, React, Node.js, Three.js, Solidity and rust. My journey with OnlyDust hackathons began at Edition 1, and I've since made 69 contributions across 14 projects. With my extensive experience on the OnlyDust platform (profile: https://app.onlydust.com/u/Ugo-X), I've honed my skills in delivering quality solutions under pressure.

I bring a unique blend of technical proficiency and user-focused design to every project, whether it's crafting immersive 3D experiences or developing smart contracts. My track record shows I can adapt quickly and contribute effectively to diverse challenges.

As we surf through Edition 8, I'm excited to leverage my skills and hackathon experience to push the boundaries of blockchain development. I'm confident in my ability to tackle new challenges and drive innovation in this space.

How I plan on tackling this issue

I will approach this issue in the following manner:

  1. I will set up Vitest for unit testing:

    a. Install necessary dependencies

    b. Configure Vitest in the project

    c. Create a test structure mirroring the src directory

  2. I will write unit tests for functions in /src/lib/stellar/* and /src/lib/utils.js:

    a. Identify testable functions

    b. Create test files for each module

    c. Write tests covering various scenarios and edge cases

  3. I will set up Playwright for integration testing:

    a. Install Playwright and necessary dependencies

    b. Configure Playwright in the project

    c. Create a basic test structure for components and pages

  4. I will write integration tests for key components and pages:

    a. Identify critical user flows

    b. Create tests simulating user interactions

    c. Verify expected outcomes and state changes

  5. I will implement CI/CD pipeline integration for automated testing.

  6. I will add code coverage reporting to identify areas needing more tests.

josephchimebuka commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello @ElliotFriend I am Joseph I am a Software developer and blockchain developer and I am also an active contributor here on only dust here is my profile https://app.onlydust.com/u/josephchimebuka. This is my first time to contribute to this repo ill appreciate the opportunity to contribute.

How I plan on tackling this issue

To address the lack of tests in the project, I will first set up a testing environment by installing both Playwright for integration tests and Vitest for unit tests. After configuring Playwright for browser-based testing and Vitest for function-level testing in the SvelteKit project, I will create a structured testing folder. Next, I will write unit tests for the core functions located in /src/lib/stellar/* and /src/lib/utils.js to ensure proper functionality. Additionally, I will review the rest of the codebase to identify other critical areas where unit tests are appropriate, ensuring comprehensive test coverage. I will complete this in 2-3 days

martinvibes commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

hello i am a frontend dev and blockchain developer please can i work on this issue :) and would love to be a contributor

How I plan on tackling this issue

To solve the add unit tests issue for ODHack8:

Set Up Testing Framework: Choose Vitest for unit tests and set it up in your project.

Identify Functions to Test: Review /src/lib/stellar/* and /src/lib/utils.js to find functions needing tests.

Create Test Files: Create corresponding test files (e.g., functionName.test.js) for each function.

Write Unit Tests: Implement tests covering various scenarios, including edge cases and error handling.

Run Tests: Execute the tests and ensure they pass.

Refactor if Needed: Refactor code for better testability if tests are failing or difficult to write.

Commit Changes: Commit your changes with a clear message about the added tests.

Documentation: Optionally, document the testing process in your project’s README.

ShantelPeters commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a blockchain developer with a strong background in html, css, javascript , typescript , this would be my first time contributing to this ecosystem . and i would be glad to work on this issue

How I plan on tackling this issue

By setting up unit tests using Vitest for functions in /src/lib/stellar/ and /src/lib/utils.js, and consider other areas where tests are needed. Optionally, use Playwright for integration tests in the SvelteKit project.

Nemezjusz commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have extensive experience in software testing within the telecom industry, focusing on both manual and automated testing for complex systems.

How I plan on tackling this issue

I would start by auditing the code in /src/lib/stellar/* and /src/lib/utils.js to identify key functions for unit testing. Also i would implement integration tests to simulate user interactions and ensure seamless component integration.

jimenezz22 commented 1 month ago

thanks @ElliotFriend for assigning me the issue, I will start working asap