short icon indicating copy to clipboard operation
short copied to clipboard

[Refactor] Check error types in tests.

Open arberiii opened this issue 4 years ago • 1 comments

What is frustrating you? Test cases that expect errors usually pass if it has any error, which is not correct if the error is different from what is expected. For example: Test case struct has the field: https://github.com/short-d/short/blob/e506d994fb6b8225e7b9f714931acb3d045b5547/backend/app/usecase/url/urlcreator_test.go#L38 Then checking the expected behavior is done in this way: https://github.com/short-d/short/blob/e506d994fb6b8225e7b9f714931acb3d045b5547/backend/app/usecase/url/urlcreator_test.go#L192-L193

Your solution Tests should pass only if the error type is precisely the one expected.

arberiii avatar May 21 '20 19:05 arberiii

https://github.com/short-d/short/pull/796/files#r436382369

magicoder10 avatar Jun 08 '20 01:06 magicoder10