ardanlabs / service

Starter-kit for writing services in Go using Kubernetes.
https://www.ardanlabs.com
Apache License 2.0
3.4k stars 612 forks source link

Remove TestGenerateSeed Funcs from business tests #367

Closed Ali-Farhadnia closed 1 month ago

Ali-Farhadnia commented 1 month ago

I've made some changes to test functions in business layer for better readability. Here's why:

Consistency: I've used the same method for seeding data in all tests, which makes them easier to follow and maintain.

Clearer Tests: Putting the test data front improves readability. It's easier to understand what each test is checking.

ardan-bkennedy commented 1 month ago

I should have used my test util functions for that. I see that now. I think it's better to be testing against random data.

Ali-Farhadnia commented 1 month ago

Do you mean that util functions must used for seeding the user too?

ardan-bkennedy commented 1 month ago

I updated the code. All tests are using the core seed data functions. We don't want to hard code anything in the tests. If you have a special need for a DB record to look a certain way, you have the ability to do that. But I would use these Test functions as a first choice.

ardan-bkennedy commented 1 month ago

MIssing something

Ali-Farhadnia commented 1 month ago

thanks bill

ardan-bkennedy commented 1 month ago

Look at it now. I think this is better. GREAT CATCH, I missed this :(

Ali-Farhadnia commented 1 month ago

Thanks bill.Yes i think that is better now :)