Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mockProperty): make sure a falsy value can be assigned to a mock property #208

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

Pmyl
Copy link
Collaborator

@Pmyl Pmyl commented Jan 30, 2020

With this PR the complex property getters will be changed from

get prop() {
  return m["prop"] || m["prop"] = createMock("some_token");
}

to

get prop() {
  return m.hasOwnProperty("prop") ? m["prop"] : m["prop"] = createMock("some_token");
}

In this way even by assigning a null value it won't create the mock.

This will close #207

@Pmyl Pmyl requested a review from uittorio January 30, 2020 19:49
@Pmyl Pmyl merged commit 0b37699 into master Jan 30, 2020
@Pmyl Pmyl deleted the #207_allow_falsy_assignments_to_mock branch January 31, 2020 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return null
2 participants