green-ecolution / green-ecolution-backend

Green Ecolution - Backend
GNU General Public License v3.0
3 stars 1 forks source link

test: utilities #224

Closed choffmann closed 1 week ago

choffmann commented 1 week ago

Close #223

choffmann commented 1 week ago

@doriengr there is a function ParseJSONResponse in internal/utils/utils.go which is only used by tests in the handler. Have you implemented this function? I would like to move this function to the utils files for the http handler. Also, I don't know exactly how to test this function, and if it is only used by tests anyway, we don't need to test the test function.

doriengr commented 1 week ago

@doriengr there is a function ParseJSONResponse in internal/utils/utils.go which is only used by tests in the handler. Have you implemented this function? I would like to move this function to the utils files for the http handler. Also, I don't know exactly how to test this function, and if it is only used by tests anyway, we don't need to test the test function.

Yes, I created it and as far as I remember I only use it in tests. Feel free to do whatever you want with it 👍

choffmann commented 1 week ago

@doriengr there is a function ParseJSONResponse in internal/utils/utils.go which is only used by tests in the handler. Have you implemented this function? I would like to move this function to the utils files for the http handler. Also, I don't know exactly how to test this function, and if it is only used by tests anyway, we don't need to test the test function.

Yes, I created it and as far as I remember I only use it in tests. Feel free to do whatever you want with it 👍

I wrote a test for this, perhaps it makes sense to use this function outside the tests as well.