Closed himynamej closed 1 month ago
The idea is to skip the seed. Not a bad idea. Do the test pass?
I don't think you can remove the seeding because that adds an admin user to the database. This is needed to run tests. You don't know what order tests may run in. You might want to just run a home test. That is why the seeding adds two initial users to the system.
I am not sure you have tried running just a CreateProduct test, which won't work without users in the system.
Granted, we don't need to query the seeded users in the app layer tests, but they are there and it can affect results. That is why I query them. You can create as many users as you want, and fix your tests to use that user.
My last statement was wrong. You can create the user using the business layer API. The question is, should we use the seeded users since they exist, or always create a new user?
seed may cause confusion in writing tests
I made changes to the repo based on your PR. I removed the seeding of the db during a test and removed those query calls. Let me know what you think.
its so good,thanks
Thanks for the PR
do you think this change is good ,do we need seed database? i want to do this in my project because its so complicated and must have different user base of every scenario