danieleades / monzo-lib

monzo API client library, in pure rust
16 stars 4 forks source link

Update Transaction to avoid serde errors #16

Closed BreD1810 closed 3 years ago

BreD1810 commented 3 years ago

This PR:

codecov[bot] commented 3 years ago

Codecov Report

Merging #16 (6f4edf7) into master (1f412da) will increase coverage by 3.72%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #16      +/-   ##
=========================================
+ Coverage    3.57%   7.29%   +3.72%     
=========================================
  Files          17      18       +1     
  Lines         224     233       +9     
=========================================
+ Hits            8      17       +9     
  Misses        216     216              
Impacted Files Coverage Δ
src/endpoints/transactions.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1f412da...6f4edf7. Read the comment docs.

danieleades commented 3 years ago

is it possible to add some unit tests to show the deserialisation works? I would recommend grabbing the raw JSON from the API playground, anonymising it, and then showing that it's correctly deserialised.

you would have to extract the logic in the send method into a function that you can unit test.

BreD1810 commented 3 years ago

is it possible to add some unit tests to show the deserialisation works?

I've added (anonymised) unit tests for:

BreD1810 commented 3 years ago

Triple checked none of the identifying values are actual ones - just tried to keep them similar to actual values that may be returned.

I essentially used ascending numbers/letters for each value, making sure the digits were in the correct location as returned by the real response. Eg:

"id": "tx_0000A1aBC2Dbc34Ede5fEH",
danieleades commented 3 years ago

brilliant work @BreD1810. Thanks again for the pull request!