This is part three of building API using Express, Sequelize, and Postgres. In part two, we built simple API endpoints to demonstrate CRUD operation...
For further actions, you may consider blocking this person and/or reporting abuse
There are no cases for api failure, It would be great if u add the failure cases as well, overall the post was pretty good and easy to understand.
You could:
when you do something intentionally wrong, as well as:
Various other uses of
expect
hereYeah, I've included some failure test cases in the sample project, I'd update the article to reflect it. Thanks for the hints.
Yeah, that's true, I seemed to focus on the success side. I'll update it to take into account your feedback. Thank you.
I tried using jest after I first read your article, but as I changed from Windows7 to Windows10 after Microsoft stopped its update(windows7); my jest test ain't working anymore.
I got the error app.address is not a function
What could be the cause, am using yarn as my package manager.
I have being using mocha and chai for my tests and it works, none works these days
Thanks in anticipation.
Could you check if the discussion in this thread helps
Thanks for the article, I followed the instructions and wrote the test code. For anyone who is looking for the sample Express Route Test using Jest (As explained in the above article) can visit this sample GitHub Repo I created.
Repo Link: github.com/prashant1k99/JWT-example
This is good content. I hope you get to complete the whole CRUD testing.
Great article
It looks like the database is not refreshed between endpoint tests, right? Means endpoint tests could affect each other, right?
Yes, that is definitely a short-cut solution, you could make each test suite independent of each other
Nice! Thanks a lot :)
I receive a timeout with log ": Timeout - Async callback was not invoked within the 10000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 10000ms timeout specified by jest.setTimeout.Error:
"
What about more real-world complex example with database connectors and sharing them around several test suites with Jest? )))
Good article with rich content!! Thank you Orie
Hello Chinedu,
It's 2021 and your post still helping people. I am one of them.
Cheers mate!
Step 2 is not needed anymore. Is the default behavior. Except the test script of course
Links in the Step4 doesn't work
your website oriechinedu.com/ is not accessible
The two links to how to setup database are erroring out.
Thanks
set content-type text/plain not working in supertest. every time it converts the text to object. any idea why ?
In this case how can I get codecoverage?
After configureing jest when i run sample test code i got this error
Nice and enriching article.
i did the same setup but i am getting bellow error.
"npm ERR! missing script: migrate:reset"
The error said that a script is missing? do you have the
migrate:reset
script in package.json?Thanks for this great tutorial, the links in this post are not working, could you please update the post?
It would be great help :)
How do we make it exit after completing the test case executions, apologies if this isn't the right place to ask such query, but it'd be helpful
Nevermind I got it, we must use --forceExit. Thank you for the post. It helped me today :) Cheers to you!!!