Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Using custom types in Contract unit tests

Satinder Rawal answered on April 22, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • Is contract testing same as API testing
  • How does Spring Framework Make Unit Testing Easy?
  • Mocking test data with custom types

  • Using custom types in Contract unit tests

    0

    If you want to use unit tests with different Contract hooks and code paths, you should mock vault methods with test data using custom types. As mentioned, the mocked vault object is based on the actual vault object specification and ensures correct arguments are passed to it. It also does not allow invalid methods to be mocked. However, the actual data that each vault method returns will need to be constructed in the Contract unit tests and added to the appropriate mocked vault method.

    The below example demonstrates custom types usage in the Smart Contract unit tests, however, the same approach should be used for Supervisor Contract tests. Note that types should be imported from the supervisor_contracts module and the SupervisorContracts380TestCase (or another version's) class should be used for the Supervisor Contract unit test. 

    Popularity 1/10 Helpfulness 1/10 Language python
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Apr 22 2023
    Satinder Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.