anikethsaha / mern

:tada: This is boilerplate for MERN stack with integrations like Redux and SSR :tada:
https://mern.netlify.com
MIT License
98 stars 44 forks source link

Adding tests [ server tests ] for the project #21

Open anikethsaha opened 5 years ago

anikethsaha commented 5 years ago

The test library I am planning to use is jest. category of tests :

For now just two, please add more if works fine

Example of a test in chai

describe('/GET /', () => {
    it('it should GET all the books', (done) => {
      chai.request(server)
          .get('/')
          .end((err, res) => {
                res.should.have.status(200);
            done();
          });
    });
});

Thanks

anmol5varma commented 4 years ago

I can provide some help.

anikethsaha commented 4 years ago

@anmol5varma that's great. Ping me if you need any help from my side.

anmol5varma commented 4 years ago

@anikethsaha Do you have some folder structure in mind?

anikethsaha commented 4 years ago

folder structure for tests?

if so, then the current seems fine like a separate test folder at the root!

and if the about the project, then I guess I may have 2nd thoughts over the present one. Cause I have made a separate folder for the component which can be shared by both server and the client mainly had a better SSR solution in my mind. So would appreciate any suggestion over this.

anmol5varma commented 4 years ago

Generally while working we have component test inside them only. Hence I would advise if we have tests on the concerned files at the same level. I have written snapshot tests for the client folder with the same logic.

anikethsaha commented 4 years ago

Okay it's fine either way. You can go ahead with your tests. If possible try to make it at the root but tests are more important irrespective of where they are so gi ahead, add your tests. Looking forward for your PR

manas2297 commented 4 years ago

is it still open to work?

anikethsaha commented 4 years ago

Yeah.... It's open.... Feel free to reach out to me if you need any help

anikethsaha commented 4 years ago

@manas2297 are you planning to add tests for the server?

AlisherU commented 2 years ago

Hi @anikethsaha, do you still need help with this?