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

PSP-7002 : H0443: Show Acq team (organization) on document #3533

Merged
merged 7 commits into from
Oct 27, 2023

Conversation

eddherrera
Copy link
Collaborator

No description provided.

@eddherrera eddherrera added the enhancement New feature or request label Oct 21, 2023
@eddherrera eddherrera self-assigned this Oct 21, 2023
@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

Merging #3533 (7f4f1d9) into dev (857fb61) will increase coverage by 4.82%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #3533      +/-   ##
==========================================
+ Coverage   68.96%   73.79%   +4.82%     
==========================================
  Files        1370      899     -471     
  Lines       33519    18499   -15020     
  Branches     6218     5210    -1008     
==========================================
- Hits        23117    13651    -9466     
+ Misses      10152     4848    -5304     
+ Partials      250        0     -250     
Flag Coverage Δ
unittests 73.79% <100.00%> (+4.82%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...tion/common/GenerateForm/hooks/useGenerateH0443.ts 92.42% <100.00%> (+3.06%) ⬆️

... and 471 files with indirect coverage changes

Comment on lines 110 to 114
const organizationPersonMock = getMockPerson({ id: 3, firstName: 'JONH', surname: 'Doe' });
getPersonConceptFn.mockResolvedValue(Promise.resolve({ data: organizationPersonMock }));

const organizationMock = getMockOrganization();
getOrganizationConceptFn.mockResolvedValue(Promise.resolve({ data: organizationMock }));
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: no need to use Promise.resolve(...) when calling mockResolvedValue - jest already returns a promise.
Please change to

  getPersonConceptFn.mockResolvedValue({ data: organizationPersonMock });

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I get an error with that suggestion.
image

Comment on lines 83 to 85
h0443Data.property_coordinator = personResponse.data
? new Api_GeneratePerson(personResponse.data)
: null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: according to github/codecov there are no unit tests covering this new functionality. Please consider adding additional tests for that.

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

Comment on lines 131 to 136
await act(async () => {
await generate(0);
expect(generateFn).toHaveBeenCalled();
expect(getPersonConceptFn).toHaveBeenLastCalledWith(3);
expect(getOrganizationConceptFn).toHaveBeenCalledTimes(1);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this is following an existing pattern in this test file but please consider changing this to:

await act(async () => generate(0));
// ...
expect(generateFn).toHaveBeenCalled();
expect(getPersonConceptFn).toHaveBeenLastCalledWith(3);
expect(getOrganizationConceptFn).toHaveBeenCalledTimes(1);

The expect statements should be called out of the act callback

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@@ -51,7 +44,7 @@ export const useGenerateH0443 = () => {
file.acquisitionFileOwners?.filter((x): x is Api_AcquisitionFileOwner => !!x) || [];
const contactOwner = owners.find(x => x.isPrimaryContact === true);

const h0443Data: H0443Data = {
let h0443Data: H0443Data = {
Copy link
Collaborator

@asanchezr asanchezr Oct 22, 2023

Choose a reason for hiding this comment

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

nit: I think there is no need to change this from const to let since you are not re-assigning the whole H0443Data object, you are just assigning some sub-properties of an existing object so const can still apply here I think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

propertyCoordinator?.organizationId,
);

if (
Copy link
Collaborator

Choose a reason for hiding this comment

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

@eddherrera for this one, it seems like we don't set a property coordinator for an org unless there is a primary contact. Is that true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct: It was specified as an acceptance criteria.

If for an applicable case primary contact is not provided leave relevant fields blank

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that seemed odd to me as well when reviewing this PR because it is a different pattern of what we usually do, but JIRA was very clear about what they want...
image

Perhaps adding a comment to avoid future confusion?

@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

1 similar comment
@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

1 similar comment
@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

1 similar comment
@github-actions
Copy link
Contributor

✅ No secrets were detected in the code.

@asanchezr asanchezr merged commit 9d1a6c3 into bcgov:dev Oct 27, 2023
8 of 9 checks passed
@eddherrera eddherrera deleted the psp-7002 branch November 1, 2023 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants