github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/docs/mock-adapter/index.md (about)

     1  ---
     2  layout: default
     3  title: Mock Adapter
     4  nav_order: 6
     5  has_children: false
     6  ---
     7  
     8  # Mock Adapter
     9  
    10  Most Chainlink jobs involve reaching out to outside APIs (referred to as "adapters") to gather data before making on-chain transactions. So along with a simulated blockchain, we also launch a mock adapter (sometimes referred to as a "mock server") that you can set and retrieve values for. We use an implementation of the [mock-server](https://www.mock-server.com/) project, but have simplified our interaction with it through just a few methods.
    11  
    12  Connect to your mock adapter much like you do with your Chainlink nodes.
    13  
    14  ```go
    15  // Get a connection to the mock server
    16  mockserver, err = client.ConnectMockServer(env)
    17  
    18  path := "/test_resp"
    19  // Any GET calls to the path will return a Chainlink-node-readable response of 5
    20  err := mockserver.SetValuePath(path, 5)
    21  
    22  // Test some things
    23  
    24  // Change the response of path to 15
    25  err := mockserver.SetValuePath(path, 15)
    26  ```