cerner / terra-application

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

jest.mock replaced with spyOn #349

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(). The testing section in documentation was updated to reflect the suggested testing method.

Testing

This change was tested using:

Reviews

This PR is a part of following JIRA: UXPLATFORM-9515