joshprzybyszewski / cribbage

A cribbage scorer and game
MIT License
2 stars 1 forks source link

Fix json game marshalling #104

Closed joshprzybyszewski closed 3 years ago

joshprzybyszewski commented 3 years ago

What broke / What you're adding

dynamo exposed an issue in the game unmarshalling. The resulting Hands field is empty right after creation, and that panics when we try to deal out cards.

How you did it

write a unit test to verify that. then simply check for the nil fields and instantiate them to empty.

How to test it and how to try to break it

CI was broken. now CI is happy.

codecov[bot] commented 3 years ago

Codecov Report

Merging #104 (12cb8bc) into master (e5be80f) will decrease coverage by 0.01%. The diff coverage is 66.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #104      +/-   ##
==========================================
- Coverage   69.79%   69.79%   -0.01%     
==========================================
  Files          80       80              
  Lines        3476     3482       +6     
==========================================
+ Hits         2426     2430       +4     
- Misses        831      832       +1     
- Partials      219      220       +1     
Impacted Files Coverage Δ
jsonutils/gameUnmarshaller.go 57.89% <66.67%> (+4.05%) :arrow_up:
server/persistence/mongodb/mongodb_service_game.go 68.66% <0.00%> (-1.49%) :arrow_down:
server/play/cut.go 50.00% <0.00%> (+5.88%) :arrow_up:

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 e5be80f...12cb8bc. Read the comment docs.