OpenFn / OpenFn/adaptors

salesforce: deep dive on unit tests

Open
#666 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DevX
Dominant language
JavaScript
Stars
24
Forks
41
Avg merge
3d 13h
Merged PRs (30d)
12

Description

Once the new salesforce API is stabilised, I want to do a deep dive on unit testing

We should use unidici mocks to mock out the requests.

I want a really clean mock API with good clean, re-usable mock data. I am tempted to bring #482 into this, although there's unrelated stuff in that PR.

I want to set a standard for unit tests on core adaptors here. We should test the happy path and different options, expand references, and error handling.

Every Operation should have a bunch of tests:

  • basic functionality (ie, writes to state.data)
  • expandable references
  • any particularly complex options need a test
  • common error patterns

I probably wouldn't bother testing references

Tests should be small, focused and precise. Each test should test exactly one thing, and do it thoroughly

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Salesforce adaptor and its existing tests, then review the proposed relationship to PR #482 and the use of unidici mocks. Done means establishing focused unit-test coverage for operations, options, expandable references, and common errors with reusable mock data, but the issue does not name specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, testing-qa
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.