core icon indicating copy to clipboard operation
core copied to clipboard

Improve unit tests

Open Gudahtt opened this issue 5 years ago • 0 comments

This is a tracking issue for improving unit tests in various ways.

Related issues:

  • #1
  • #744
  • #745
  • #746
  • #748
  • #493
  • #749
  • #750
  • #743

Some general advice: writing unit tests should be easy. They may be verbose and time consuming to write, but they should be easy. If it's not easy, change the API under test to make it easy.

Many of the APIs in this repository make unit testing difficult. Your time is better spent improving the API first and writing simple unit tests, rather than struggling to write complex tests for a complex API. Consider ways to reduce the API surface, reduce dependencies, inject dependencies to simplify stubbing, and move complex functionality into separate modules.

Tracker by module:

Check off each module as they are audited for each of the criteria outlined above.

  • [ ] ./src/announcement/AnnouncementController.test.ts
  • [ ] ./src/permissions/Caveat.test.ts
  • [ ] ./src/permissions/PermissionController.test.ts
  • [ ] ./src/permissions/rpc-methods/requestPermissions.test.ts
  • [ ] ./src/permissions/rpc-methods/getPermissions.test.ts
  • [ ] ./src/permissions/errors.test.ts
  • [ ] ./src/permissions/Permission.test.ts
  • [ ] ./src/keyring/KeyringController.test.ts
  • [ ] ./src/notification/NotificationController.test.ts
  • [ ] ./src/third-party/EnsController.test.ts
  • [ ] ./src/third-party/PhishingController.test.ts
  • [ ] ./src/BaseControllerV2.test.ts
  • [ ] ./src/message-manager/MessageManager.test.ts
  • [ ] ./src/message-manager/AbstractMessageManager.test.ts
  • [ ] ./src/message-manager/PersonalMessageManager.test.ts
  • [ ] ./src/message-manager/TypedMessageManager.test.ts
  • [ ] ./src/assets/AccountTrackerController.test.ts
  • [ ] ./src/assets/AssetsContractController.test.ts
  • [ ] ./src/assets/NftController.test.ts
  • [ ] ./src/assets/assetsUtil.test.ts
  • [ ] ./src/assets/CurrencyRateController.test.ts
  • [ ] ./src/assets/TokenBalancesController.test.ts
  • [ ] ./src/assets/TokenListController.test.ts
  • [ ] ./src/assets/TokenDetectionController.test.ts
  • [ ] ./src/assets/NftDetectionController.test.ts
  • [ ] ./src/assets/TokensController.test.ts
  • [ ] ./src/assets/TokenRatesController.test.ts
  • [ ] ./src/assets/Standards/NftStandards/ERC721/ERC721Standard.test.ts
  • [ ] ./src/assets/Standards/NftStandards/ERC1155/ERC1155Standard.test.ts
  • [ ] ./src/assets/Standards/ERC20Standard.test.ts
  • [ ] ./src/user/AddressBookController.test.ts
  • [ ] ./src/user/PreferencesController.test.ts
  • [ ] ./src/subject-metadata/SubjectMetadataController.test.ts
  • [ ] ./src/network/NetworkController.test.ts
  • [ ] ./src/ControllerMessenger.test.ts
  • [ ] ./src/ratelimit/RateLimitController.test.ts
  • [ ] ./src/gas/fetchGasEstimatesViaEthFeeHistory.test.ts
  • [ ] ./src/gas/fetchGasEstimatesViaEthFeeHistory/calculateGasFeeEstimatesForPriorityLevels.test.ts
  • [ ] ./src/gas/gas-util.test.ts
  • [ ] ./src/gas/determineGasFeeCalculations.test.ts
  • [ ] ./src/gas/fetchBlockFeeHistory.test.ts
  • [ ] ./src/gas/GasFeeController.test.ts
  • [ ] ./src/BaseController.test.ts
  • [ ] ./src/ComposableController.test.ts
  • [ ] ./src/transaction/TransactionController.test.ts
  • [ ] ./src/util.test.ts
  • [ ] ./src/apis/crypto-compare.test.ts
  • [ ] ./src/apis/token-service.test.ts
  • [ ] ./src/approval/ApprovalController.test.ts

Gudahtt avatar Mar 18 '21 21:03 Gudahtt