You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, our Salesforce adapter uses state.connection to establish the session and removes state.connection at the end of execution. To improve the structure and maintainability of the code, we want to refactor the adaptor to use a client setup similar to what we have done with our Hive and GoogleSheets adaptor. This involves the following changes:
Remove state.connection.
Introduce a client or session variable (e.g., let client = null; or let session = null;).
Set up the client using a new function createConnection().
Destroy the client using a new function removeConnection().
Tasks:
Remove state.connection:
Identify all instances where state.connection is used.
Refactor the code to remove state.connection.
Introduce client variable:
Define a new client or session variable (e.g., let client = null;).
Update createConnection() function:
Implement a function createConnection() that initializes the client.
Ensure the function handles all necessary configurations and authentication.
Create removeConnection() function:
Implement a function removeConnection() that properly closes and cleans up the client session.
Ensure the function handles any necessary cleanup and error handling.
Refactor code to use client:
Update all relevant parts of the adapter to use the new client variable.
Replace instances of state.connection with the appropriate client methods and properties.
Testing:
Thoroughly test the refactored adaptor to ensure it functions correctly.
Ensure all existing functionality is preserved and no regressions are introduced.
The unit tests currently rely on state.connection to provide a mock connection handler.
What you'll need to do is provide something like a setMockClient(client) private function in the adaptor. A bit like how we handle mock connections in common http.
Then the tests will call setMockClient each time and provide mock implementations to satisfy the tests
This is sort of what I want to do in the mockable tests epic, but I agree that we need to fix salesforce before we pick that epic up.
Description:
Currently, our Salesforce adapter uses
state.connection
to establish the session and removesstate.connection
at the end of execution. To improve the structure and maintainability of the code, we want to refactor the adaptor to use a client setup similar to what we have done with our Hive and GoogleSheets adaptor. This involves the following changes:state.connection
.let client = null;
orlet session = null;
).createConnection()
.removeConnection()
.Tasks:
Remove
state.connection
:state.connection
is used.state.connection
.Introduce client variable:
let client = null;
).Update
createConnection()
function:createConnection()
that initializes the client.Create
removeConnection()
function:removeConnection()
that properly closes and cleans up the client session.Refactor code to use client:
state.connection
with the appropriate client methods and properties.Testing:
References:
Related Issues/PRs:
The text was updated successfully, but these errors were encountered: