lootek / go-port-service

A playground for a simple Go application following DDD, SOLID, Clean/Hex arch principles
MIT License
0 stars 0 forks source link

Tests for core business logics #1

Open andrzejWilde opened 1 year ago

andrzejWilde commented 1 year ago

The codebase contains tests for simple model-to-model transformations yet it lacks tests for core business logics. Could you add tests that would verify correctness of the main functionality, please?

Please have a think should this be accomplished by extra unit tests, integration tests or perhaps both.

lootek commented 1 year ago

@andrzejWilde, yeah, you're right there should've been more tests (as always ;) ). And those were beneficial even at the time of writing as I noticed I was initially not very strict with the requirements - so I've changed the code to expose Upsert() (instead of Add()/Update()). Plus it was more obvious and kind of natural when called from the HTTP handler. The next thing to do is to add test cases for the JSON file upload there which I don't have time for right now.

The next major thing to do that's worth adding is a high-level integration test to be run in the dockerized runtime environment (most probably using sth like a python helper script). Its logic would be very simple, yet needs some additional work to set things up:

I also added some TODO notes for the future in the code.

I wish I had more time to spend on this and polish it to be a really nice and clean e2e-ready codebase.