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 integration tests #14

Open
ElliotFriend opened this issue Sep 25, 2024 · 11 comments
Open

Add integration tests #14

ElliotFriend opened this issue Sep 25, 2024 · 11 comments
Assignees
Labels
ODHack8 Issues eligible for the OnlyDust hackaton

Comments

@ElliotFriend
Copy link
Contributor

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.

Integration tests should be written for the components and pages? Not really sure. I'm not very familiar with writing integration tests for Svelte(Kit) apps, so I'm not exactly sure of the scope for this.

@ElliotFriend ElliotFriend added the ODHack8 Issues eligible for the OnlyDust hackaton label Sep 25, 2024
@CollinsC1O
Copy link

hello @ElliotFriend I'm a frontend and also a blockchain developer. I will love to work on this please

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.

@Dprof-in-tech
Copy link

Dprof-in-tech commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello, i am Dprof-in-tech, an experienced Full Stack Blockchain Developer and I am excited to contribute my skills to this project in this ODHACK 8. With a strong background in Next.js, TypeScript, JavaScript, React, Node.js, Rust and Cairo, I've honed my technical skills across the blockchain development landscape.

My journey with OnlyDust began at Edition 2, and I've since made 34 contributions across 11 projects. This extensive experience on the platform has allowed me to develop a keen understanding of delivering high-quality solutions under tight deadlines.
Due to my web2 experience, i am skilled in writing unit tests and have used Jest and Vitest to do this. I would love to contribute to this project by solving this issue.

Below is a link to my OnlyDust public profile.
https://app.onlydust.com/u/Dprof-in-tech

How I plan on tackling this issue

Here is the approach i would use in building a solution to this issue while focusing on writing standard unit tests.

  1. First things first, gotta set up Vitest. It's pretty straightforward:

  2. Now, I'll go through /src/lib/stellar/* and /src/lib/utils.js, make a list of all the exported functions, and decide which ones are the most important or complex. Those are the ones I'll tackle first.

  3. For each file, I'll make a matching test file right next to it. So like, utils.js gets a utils.test.js buddy.

  4. Writing the actual tests is where the fun begins:

    • Start simple: just check if the function exists
    • Test the normal inputs and outputs
    • Throw some weird stuff at it (empty inputs, huge numbers, etc.)
    • Make sure it doesn't fall apart when something goes wrong
  5. If a function is calling APIs or doing something I can't easily test, I'll mock that stuff out. No need to actually hit external services for unit tests.

  6. I want to know how much of my code I'm actually testing, so I'll set up coverage:

  7. I'll start with the easy functions and work my way up to the trickier ones. Utilities are super important, so I'll make sure those are rock solid.

  8. To keep things organized, I'll use describe blocks. Group tests for each function, and if a function has different scenarios, I'll nest describe blocks.

  9. Once I've got a decent set of tests, I'll set up GitHub Actions to run them on every commit. No broken code sneaking into main!

  10. Last but not least, I've gotta keep these tests up to date. When I change a function, I update its tests. New function? New tests. And every now and then, I'll go through and clean up the tests to keep them running smooth.

I believe with this approach and your essential code review, id give the perfect solution to this issue.

@jimenezz22
Copy link

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:

  1. Set Up Playwright: I'll set up Playwright for integration testing, which is well-suited for SvelteKit apps, especially for user interactions and navigation.
  2. Identify Key Components/Pages: I’ll review the project to identify crucial payment components and pages, such as the checkout process and transaction confirmations.
  3. Write Integration Tests:
    • Basic Flow: Test payment submissions, form validation, and transaction result displays.
    • Navigation: Ensure smooth navigation between different payment-related pages.
    • Error Handling: Test invalid inputs and payment failures, ensuring proper error messaging.
  4. Test Setup/Cleanup: Implement processes to isolate tests and prevent state conflicts between them.
  5. Refine Scope: Start with core payment flows and expand test coverage as needed.

Estimated Time: 3-4 days

@Mario-Araya
Copy link

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

Set Up Testing Frameworks:
I would start by configuring the project to include either Playwright for integration tests or Vitest for unit tests. This can be done by following the documentation for integrating these testing frameworks into a SvelteKit project.

Understand Test Scope:
Since you’re not familiar with writing integration tests for SvelteKit, I would review the components and pages within the project to determine which parts are crucial to test. Typically, integration tests should cover:

Core Components: Ensure that key components render correctly and interact as expected.
Pages: Validate the behavior of pages when navigating through the app, ensuring the correct components load and user interactions work.
Write Integration Tests:
I would begin writing integration tests for important user flows, such as:

Rendering specific components on the page.
Checking if user interactions (like clicks or form submissions) produce the expected outcomes.
Verifying that the app maintains the correct state after interactions.
Create Unit Tests:
If using Vitest, I would write unit tests for smaller functions or components that don’t require a full application context. This may include testing:

Utility functions.
Individual component logic to ensure props and state management work as intended.
Documentation and Learning Resources:
Since you're not very familiar with SvelteKit testing, I would look for tutorials, documentation, or examples specifically related to testing in SvelteKit to help guide the process. The official documentation for both Playwright and Vitest would be good starting points.

Run Tests:
After implementing the tests, I would run them to ensure they pass and provide the expected coverage for the project.

Refactor and Expand:
If time permits, I would refactor existing components and pages to enhance testability, and I’d continue to expand the test suite as needed based on feedback or further understanding of the application’s requirements.

@gregemax
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have a background in JavaScript and experience with Playwright and Vitest for test my testing skills will help implement effective integration tests for the project

How I plan on tackling this issue

I would set up Playwright for integration testing, identify key user interactions in the SvelteKit app, and start by writing tests for the most critical components and pages, gradually expanding coverage as I learn more about the framework.

@thesledge04
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have a background in developing applications using various frameworks, which gives me insight into testing best practices. While I may not have extensive experience with Svelte(Kit), I can leverage my knowledge of unit and integration testing principles from other frameworks.

How I plan on tackling this issue

Choose Playwright for integration tests and set it up.
Define test scope focusing on user flows and components.
Write and validate test cases for critical paths.
Run tests regularly during development.
Document the testing process for clarity.

@martinvibes
Copy link

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

Issue Summary:
Problem: The project currently lacks tests, which needs to be addressed.
Action Items:
Add Integration Tests:

Write integration tests for the components and pages of the project. Tools like Playwright (for integration tests) or Vitest (for unit tests) are recommended since they can be set up with new SvelteKit projects.
Determine Scope:

Clarify the scope of the integration tests. Focus on testing the behavior of components and pages, ensuring that they work as intended within the app.
Recommended Tools:

Playwright: For end-to-end and integration testing.
Vitest: For unit tests, though the main focus here seems to be integration.

@Nemezjusz
Copy link

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.

@josephchimebuka
Copy link

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 solve this, I will first decide between using Playwright for integration tests or Vitest for unit tests based on the project needs. Since integration tests are required for components and pages, I will review Playwright's documentation for guidance on writing integration tests specifically for SvelteKit. I'll then set up the project to include test structure, ensuring that components and pages are tested in real user scenarios. For unit testing, I will use Vitest to ensure individual functions work correctly. If uncertain about the scope of integration tests, I’ll start by testing key user interactions and gradually expand coverage as necessary.

@jimenezz22
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ODHack8 Issues eligible for the OnlyDust hackaton
Projects
None yet
Development

No branches or pull requests

10 participants