department-of-veterans-affairs / va-mobile-library

https://department-of-veterans-affairs.github.io/va-mobile-library/
ISC License
0 stars 0 forks source link

Link - Enhance Unit Tests for OSFunction Calls #278

Closed TimRoe closed 3 weeks ago

TimRoe commented 1 month ago

Description

Split from #134.

Ticket #134 did basic mocking of OSFunctions calls (ensuring the correct data is sent as expected), but did not deep dive into formally testing the logic which was scope tangential to the Link itself. This ticket is to formally add tests to for FormDirectionsUrl and useExternalLink.

FormDirectionsUrl should be fairly straightforward to just validate input X yields output Y.

useExternalLink is more nuanced since it is a hook and includes conditionally a prompt that appears and should be inspected for accuracy; it is unclear if this can be done totally separately or needs to be worked in as part of the Link component itself overriding the mocking behavior or making the mock more sophisticated to actually open the prompt for validation.

Acceptance Criteria

- [x] Add units tests to validate `FormDirectionsUrl` logic - [x] Add units tests to validate `useExternalLink` behavior