Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure results for SalesforceResultState functions #894

Merged
merged 19 commits into from
Jan 10, 2025

Conversation

mtuchi
Copy link
Collaborator

@mtuchi mtuchi commented Jan 9, 2025

Summary

Restructured response format for bulk, create, update and destroy functions:

Fixes #878

Details

Added standardized result structure:

{
    success: boolean,
    completed: number,
    errors: [
      {
        id: string,
        message: string
      }
    ]
}

For bulk function and for destroy() function when deleting multiple records. I have also added integration tests for bulk, update, destroy and create function, to run the test get credentials from LP: Salesforce Demo Org (API user)

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

Review Checklist

Before merging, the reviewer should check the following items:

  • Does the PR do what it claims to do?
  • If this is a new adaptor, added the adaptor on marketing website ?
  • Are there any unit tests?
  • Is there a changeset associated with this PR? Should there be? Note that
    dev only changes don't need a changeset.
  • Have you ticked a box under AI Usage?

@mtuchi mtuchi changed the title 878 result objects Restructure results for bulk and destroy Jan 9, 2025
@mtuchi mtuchi requested a review from josephjclark January 9, 2025 16:48
@mtuchi mtuchi marked this pull request as ready for review January 9, 2025 16:48
@mtuchi mtuchi changed the title Restructure results for bulk and destroy Restructure results for SalesforceResultState functions Jan 9, 2025
@@ -134,3 +134,36 @@ export async function pollJobResult(conn, job, pollInterval, pollTimeout) {
attempt++;
}
}

export function formatResults(input) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration tests are cool but I would value unit tests against this function way more!

I won't block the PR for tests on this though (especially as I've requested a change). If you have time for a few tests that's great. If you don't, don't worry.

What I'm really trying to say is: consider unit testing before integration testing. Also when you write a nice clean standalone util function like this, it's a great candidate for unit tests!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reminder I have added couple of unit test for formatResults

@mtuchi mtuchi requested a review from josephjclark January 10, 2025 13:55
@josephjclark josephjclark merged commit b066f88 into epic/salesforce Jan 10, 2025
1 check passed
@josephjclark josephjclark deleted the 878-result-objects branch January 10, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants