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

Cover resource_data_record with unit tests #341

Merged
merged 5 commits into from
Jun 18, 2024

Conversation

mawasile
Copy link
Contributor

This pull request involves changes to the internal/powerplatform/services/data_record/api_data_record.go file, which is part of the data record service in the Power Platform. The changes mainly include updates to the ApplyDataRecord and DeleteDataRecord functions, and the applyRelations function. Additionally, new test data has been added to multiple JSON files in the internal/powerplatform/services/data_record/tests/resource/Validate_Create directory.

Here are the most significant changes:

Updates to api_data_record.go:

  • func (client *DataRecordClient) ApplyDataRecord(ctx context.Context, recordId, e: Changed the regex match from FindStringSubmatch to FindAllStringSubmatch to capture all matches instead of just the first one. Also, updated the result.Id assignment to use the last match instead of the first one.
  • func (client *DataRecordClient) ApplyDataRecord(ctx context.Context, recordId, e: Removed the call to parseLocationHeader function and the function itself, which was used to parse the location header from the API response. [1] [2]
  • func applyRelations(ctx context.Context, client *DataRecordClient, relations map: Added error handling for the API execution in the applyRelations function.

Additions to test data:

mattdot
mattdot previously approved these changes Jun 17, 2024
eduardodfmex
eduardodfmex previously approved these changes Jun 18, 2024
Copy link
Contributor

@eduardodfmex eduardodfmex left a comment

Choose a reason for hiding this comment

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

unit test passed-ok locally.

@mawasile mawasile dismissed stale reviews from eduardodfmex and mattdot via ed6fb88 June 18, 2024 06:39
@mattdot mattdot merged commit 52e197e into main Jun 18, 2024
7 checks passed
@mattdot mattdot deleted the mawasile/cover-data-record-with-unit-tests branch June 18, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants