NethermindEth / juno

Starknet client implementation.
https://juno.nethermind.io
Apache License 2.0
402 stars 170 forks source link

Fix core/state_test tests failure #2198

Closed weiihann closed 1 month ago

weiihann commented 1 month ago

If we run the test in the following command:

go test ./core/state_test.go -v

We would get test errors as such:

...
cbor: cannot unmarshal map into Go struct field core.DeclaredClass.Class of type core.Class

But if we run the test with the following command, no errors are found:

go test ./core -v

The cbor encoder and decoder that we are using are initialized globally. In the case when are running tests, running all the tests in the core package would initialize the encoder/decoder correctly, but some struct types were registered properly if we only run the state_test.go.

This PR attempts to fix the proper registering and deregistering types in the state_test.go file.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.56%. Comparing base (f20c3de) to head (11d0421). Report is 8 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2198 +/- ## ========================================== + Coverage 78.54% 78.56% +0.02% ========================================== Files 102 102 Lines 9205 9205 ========================================== + Hits 7230 7232 +2 + Misses 1343 1341 -2 Partials 632 632 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.