Skip to content

Conversation

mrazauskas
Copy link
Contributor

Split from #13202

Summary

Current return type of generateFromMetadata method of ModuleMocker is Mock<T>. That is the type of jest.fn(), but not of a mocked module. This PR implements Mocked<T> as the return type.

Few more internal types got cleaned up. For instance, it appeared that I was misusing UnknownFunction type previously.

Test plan

Type tests added.

@@ -7,7 +7,7 @@

/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */

export type MockFunctionMetadataType =
export type MockMetadataType =
Copy link
Contributor Author

@mrazauskas mrazauskas Sep 2, 2022

Choose a reason for hiding this comment

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

Having Function in this and MockFunctionMetadata type is misleading. Sounds like they are related with mock functions, but in fact these are definitions for mocked modules / objects. Might be helpful to change the names for future readers.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

awesome work 👍

@SimenB
Copy link
Member

SimenB commented Sep 3, 2022

@github-actions
Copy link

github-actions bot commented Oct 4, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2022
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