hedera-services icon indicating copy to clipboard operation
hedera-services copied to clipboard

Improve TokenService (Crypto Service as well) Code Coverage

Open Neeharika-Sompalli opened this issue 10 months ago • 1 comments

Add more unit tests to improve code coverage to each class in Token Service

  1. Checked box without issue indicates False negative for coverage where codacy reports 0% coverage but test exists.
  2. Checked box with Issue indicates the associated issue has been addressed.
  3. List items in bold represent classes falling below 80% coverage and targeted for improvement

API

  • [x] TokenServiceApiImpl [-]
  • [x] TokenServiceApiProvider [100 %]
  • [x] #13110

CODEC

  • [ ] TokenComparators [83.33 %]

COMPARATOR

  • [x] #13153

STAKING HANDLERS

  • [ ] EndOfStakingPeriodUtils [95.24 %]
  • [ ] StakeIdChangeType [80.39 %]
  • [ ] StakeInfoHelper [98.36 %]
  • [x] StakePeriodManager [100 %]
  • [x] #13111
  • [ ] StakeRewardCalculatorImpl [91.86 %]
  • [ ] StakingRewardsDistributor [97.5 %]
  • [x] StakingRewardsHandler [100 %]
  • [ ] StakingRewardsHandlerImpl [96.86 %]
  • [ ] #13202
  • [x] #13112

CUSTOM FEES HANDLERS

  • [ ] AdjustmentUtils [83.58 %]
  • [ ] AssessmentResult [91.3 %]
  • [ ] #13214
  • [ ] #13141
  • [x] CustomFeeMeta [100 %]
  • [ ] #13212
  • [ ] #13213
  • [ ] #13163
  • [ ] AdjustFungibleTokenChangesStep [93.9 %]

TRANSFER HANDLERS

  • [ ] AdjustHbarChangesStep [92.19 %]
  • [ ] AssociateTokenRecipientsStep [73.97 %]
  • [x] AutoAccountCreator [100 %]
  • [ ] #13162
  • [ ] EnsureAliasesStep [95.29 %]
  • [ ] NFTOwnersChangeStep [91.06 %]
  • [ ] ReplaceAliasesWithIDsInOp [92.86 %]
  • [ ] TransferContext [72.56 %]
  • [ ] TransferContextImpl [0 %]
  • [x] TransferStep [100 %]

HANDLERS

  • [x] #13146
  • [x] BaseTokenHandler [100%]
  • [ ] CryptoAddLiveHashHandler [71.43 %] – #13187
  • [ ] CryptoApproveAllowanceHandler [76.83 %] – #13187
  • [ ] CryptoCreateHandler [76.43 %]
  • [ ] CryptoDeleteAllowanceHandler [80.77 %]
  • [ ] CryptoDeleteHandler [87.1 %]
  • [ ] CryptoDeleteLiveHashHandler [83.33 %]
  • [x] CryptoGetAccountBalanceHandler [100 %]
  • [ ] CryptoGetAccountInfoHandler [91.94 %]
  • [ ] CryptoGetAccountRecordsHandler [78.95 %]
  • [x] CryptoGetLiveHashHandler [100 %]
  • [x] CryptoGetStakersHandler [100 %]
  • [ ] CryptoTransferHandler [57.94 %] #13166
  • [ ] CryptoUpdateHandler [65.41 %] #13166
  • [x] FinalizeChildRecordHandler [100 %]
  • [ ] FinalizeParentRecordHandler [68 %]
  • [ ] TokenAccountWipeHandler [84.16 %]
  • [ ] TokenAssociateToAccountHandler [82.46 %]
  • [ ] TokenBurnHandler [85.71 %]
  • [ ] TokenCreateHandler [86.52 %]
  • [ ] TokenDeleteHandler [83.33 %]
  • [ ] TokenDissociateFromAccountHandler [82.73 %]
  • [ ] TokenFeeScheduleUpdateHandler #13166
  • [ ] TokenFreezeAccountHandler [89.13 %]
  • [x] TokenGetAccountNftInfosHandler [100 %]
  • [ ] TokenGetInfoHandler [91.95 %]
  • [ ] TokenGetNftInfoHandler [88.33 %]
  • [x] TokenGetNftInfosHandler [100 %]
  • [ ] TokenGrantKycToAccountHandler [89.74 %]
  • [x] #13160
  • [x] TokenMintHandler [100 %]
  • [ ] TokenPauseHandler [72.73 %]
  • [ ] TokenRevokeKycFromAccountHandler [90.24 %]
  • [ ] TokenUnfreezeAccountHandler [89.13 %]
  • [ ] TokenUnpauseHandler [71.88 %]
  • [ ] TokenUpdateHandler [94.06 %]
  • [ ] TokenUpdateNftsHandler [82 %]

SCHEMAS

  • [ ] InitialModServiceTokenSchema [51.43 %]
  • [ ] SyntheticRecordsGenerator [94.6 %]

SERDES

  • [ ] EntityNumCodec [90 %]

UTIL

  • [ ] TokenHandlerHelper [93.75 %]
  • [ ] TokenKey [96.3 %]
  • [ ] TokenRelListCalculator [97.37 %]

VALIDATORS

  • [ ] AllowanceValidator [96.88 %]
  • [x] ApproveAllowanceValidator [100 %]
  • [ ] CryptoCreateValidator [83.33 %]
  • [ ] CryptoTransferValidator [96.43 %]
  • [ ] CustomFeesValidator [98.32 %]
  • [ ] DeleteAllowanceValidator [97.3 %]
  • [ ] StakingValidator [90.91 %]
  • [x] TokenAttributesValidator [100 %]
  • [x] TokenCreateValidator [100 %]
  • [ ] TokenListChecks [68 %] – the only missing line is a private constructor...
  • [x] TokenSupplyChangeOpsValidator [100 %]
  • [x] TokenUpdateValidator [100 %]

BASE PACKAGE

  • [ ] BlocklistParser [95.65 %]
  • [x] CryptoSignatureWaiversImpl [100 %]
  • [ ] ReadableAccountStoreImpl [94.29 %]
  • [x] ReadableNetworkStakingRewardsStoreImpl [100 %]
  • [x] ReadableNftStoreImpl [100 %]
  • [x] ReadableStakingInfoStoreImpl [100 %]
  • [x] ReadableTokenRelationStoreImpl [100 %]
  • [x] ReadableTokenStoreImpl [100 %]
  • [ ] RecordFinalizerBase [80.16 %]
  • [x] #13164
  • [ ] TokenServiceInjectionModule [0 %]
  • [ ] WritableAccountStore [90 %]
  • [x] WritableNetworkStakingRewardsStore [100 %]
  • [ ] WritableNftStore [96.15 %]
  • [x] WritableStakingInfoStore [100 %]
  • [x] WritableTokenRelationStore [100 %]
  • [ ] WritableTokenStore [85 %]

Neeharika-Sompalli avatar Apr 24 '24 19:04 Neeharika-Sompalli

There are some instances of false negatives for code coverage reported in codacy. See TokenServiceApiImpl as an example where it appears there is no coverage but the test class exists. These classes should be documented and additional coverage should be de-prioritized until we run independent coverage eg. jacoco to support

Screenshot 2024-05-06 at 8 58 01 PM

Screenshot 2024-05-06 at 9 00 43 PM

thomas-swirlds-labs avatar May 06 '24 19:05 thomas-swirlds-labs