cerner / terra-application

A framework to support application development with Terra components
Apache License 2.0
8 stars 13 forks source link

Update uuid mock to spyOn for v1 #350

Closed adoroshk closed 1 year ago

adoroshk commented 1 year ago

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:

Reviews

In addition to engineering reviews, this PR needs:

Additional Details

This PR is a part of following JIRA:

UXPLATFORM-9515