GithubHelp home page GithubHelp logo

add unit tests about stargazed HOT 32 OPEN

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024
add unit tests

from stargazed.

Comments (32)

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024 4

Also I really like your project and how you have communicated, it's been a pleasant experience. So I certainly would like to assist 😄

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024 2

@JacobMGEvans Thanks a lot for that.

It's not everyday someone helps in such tiny OSS projects. Glad that you are ready to contribute. Appreciate it.

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024 2

@abhijithvijayan
Alright, I got this mostly figure out it was not configuration issues. The fact you were using a module.exports on an anonymous async function was making is impossible to test... I have some solutions,

  1. firstly I am going to make the test work with the code as-is then make the PR

  2. I am going to refactor it to use ES6 modules import/export which export default should would the same as how you have module.exports with the testing in place we can refactor with confidence it will keep working as expected.

  3. Once the import/export is in place testing specific functions will be far easier and refactoring the code base will be far easier.

  4. Integration and E2E(likely not needed) will be the next endeavor

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024 1

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024 1

@JacobMGEvans I think a lot of code refactoring is needed here and there in the source code. This was all written very soon so didn't get time to refactor.

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024 1

Wow! Congratulations, definitely a good idea to refactor for performance then!

You can assign other people, I probably will still write tests soon regardless. I am just finishing up with another issue from a different OSS and a few from my own side project.

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024 1

Last night I started focusing on the unit tests, I am having issues importing the functions and statements for some reason... Might need to spend a little more time on the jest configuration, not sure what's the exact problem yet.

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024 1

@JacobMGEvans Told ya, it's messed up.

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024 1

@JacobMGEvans I am open to any modifications as long as the project works and code quality is improved.

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024 1

@abhijithvijayan Interesting enough if I try to pass false into the options that are primitives is throws an error, if I pass true it works fine... I might open a bug issue a little bit

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024 1

@JacobMGEvans I was trying out the error fixes. Feel free to work on it.

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

Could I get assigned to this?

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024

@JacobMGEvans How is that PR coming ?

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

I did add exports to a lot of the functions in the file, but those can easily be removed when determined which ones are not needed for isolated testing.

I was also trying to get a feel for the codebase/the flow of data and how to approach testing it.

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

Well, tests will definitely help when you go to refactor because you can just run watch on them and make sure the tests don't break :)

I try to write tests so the code implementation doesn't matter i.e. refactors dont break them... the only thing that matters is the input => output and behaviors remain the same/consistent.

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024

@JacobMGEvans You want me to assign this to someone else?

Refactor seems to be quite needed as CLI hit 2700+ weekly downloads. 😀

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

lmao, I am certain I can figure it out I just wanted to keep you updated 😆

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

Would you be able to give me some mock or actual payloads and responses? I would rather not go through the whole process if you have anything like that leftover from developing it.

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024

@JacobMGEvans I have fixed the export issue and also added a sample mock payload to the test file.

Now you can continue adding tests.

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

Huh, it was working fine when I tested it locally... I use babel-node though 😬 lol

Glad you got it fixed though Ill check out the changes and continue with testing.

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

Someone also uncommented out tests that I had TODOs on because they were incomplete and a comment was added that "it doesnt return anything" which is why there was a TODO there to finish the test...

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024

@JacobMGEvans Is babel config and its packages needed to run the tests?

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

https://jestjs.io/docs/en/getting-started#using-babel

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024

@JacobMGEvans The tests are almost complete right!

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024

@JacobMGEvans not really.

CLI creates README.md, and local file is readme.md

If you have tried the cli within the folder, you can see it doesn't affect the original readme.md file

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

I wasn't asking a question I was stating what happens when you run the function in the Jest test, also it is not cap sensitive, Node just writes to the readme.md, like I said.

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024

I thought since the command Node cli.js -u "USERNAME" creates README.md along with readme.md, it wouldnt be a problem too, while testing.

Maybe renaming current readme.md to just readme might help right!

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

from stargazed.

abhijithvijayan avatar abhijithvijayan commented on May 26, 2024

@JacobMGEvans A lot has changes since the last test added.

I have refactored the code a lot and it seems to be stable now. All the test suites are still working as expected.

Are you currently on other projects now for not be able to work on this issue anymore?

from stargazed.

JacobMGEvans avatar JacobMGEvans commented on May 26, 2024

from stargazed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.