thor icon indicating copy to clipboard operation
thor copied to clipboard

Add testchain package

Open otherview opened this issue 5 months ago • 4 comments

Description

  • Added testchain package testchain package is meant to be used for testing. It simplifies the common uses for the thor chain in tests. Wraps most of the most used operations like mint a transaction. It has a chain builder that allows to create thor chain with a different subset of components (inmem vs realdb, etc..)

  • Added eventcontract package eventcontract package is a precompiled contract It's meant to help trigger events on-chain and test these ( subscriptions and events tests )

  • Simplified the initChain logic initChain now returns a testchain and can be easily manipulated in-test

  • Removed (many but not all) global test vars

  • Added thorclient/api_test.go which allows to test requests and response payloads for several apis

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [x] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [x] Test A
  • [x] Test B

Test Configuration:

  • Go Version:
  • Hardware:
  • Docker Version:

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [x] New and existing E2E tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules
  • [x] I have not added any vulnerable dependencies to my code

otherview avatar Sep 10 '24 14:09 otherview