Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Update uuid mock to spyOn for v1 #350

Merged

Conversation

adoroshk
Copy link
Contributor

@adoroshk adoroshk commented Aug 29, 2023

Summary

Currently the uuid test mocks are hard coded. In order to ensures that every test is fresh and independent of each other, the proposed solution was to use beforeAll() to set up the mock. As jest.mock can't be used inside of the tests or inside beforeAll, jest.spyOn was used instead of jest.mock.

What was changed:
Hard-coded jest.mock were replaced with jest.spyOn inside the beforeAll().
The mocks were restored in afterAll().
Imports for uuid were changed to { v4 as uuidv4 } from 'uuid'; to allow use the jest.spyOn and consistency with the rest of Terra projects.
uuid version was locked to version 3.4.0 for consistency with the rest of Terra projects.

Testing

This change was tested using:

  • WDIO
  • Jest
  • Visual testing (please attach a screenshot or recording)
  • Other (please describe below)
  • No tests are needed

Reviews

In addition to engineering reviews, this PR needs:

  • UX review
  • Accessibility review
  • Functional review

Additional Details

  • The jest test errors are not related to current change.
  • The change is not user-facing and does not require a changelog entry.

This PR is a part of following JIRA:

UXPLATFORM-9515

@adoroshk adoroshk requested a review from sdadn August 29, 2023 21:23
@adoroshk adoroshk self-assigned this Aug 29, 2023
@adoroshk adoroshk changed the title Update uuid mock to spyOn Update uuid mock to spyOn for v1 Aug 29, 2023
@github-actions github-actions bot temporarily deployed to preview-pr-350 August 30, 2023 18:57 Destroyed
@adoroshk adoroshk merged commit 506e3e8 into terra-application-v1 Aug 30, 2023
6 checks passed
@adoroshk adoroshk deleted the uuid-mock-update-for-terra-application-v1 branch August 30, 2023 19:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants