Skip to content

Add Vibration module mock#30643

Closed
hduprat wants to merge 1 commit into
facebook:mainfrom
hduprat:jest/add-vibration-module-mock
Closed

Add Vibration module mock#30643
hduprat wants to merge 1 commit into
facebook:mainfrom
hduprat:jest/add-vibration-module-mock

Conversation

@hduprat
Copy link
Copy Markdown
Contributor

@hduprat hduprat commented Dec 24, 2020

Summary

I wrote a test for a vibration feature in a react native app by importing the Vibration module and using jest.spyOn(Vibration, 'vibrate').

I had the following error:

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'Vibration' could not be found. Verify that a module by this name is registered in the native binary.

That lead me to look for (and not find) a mock for the Vibration module in the code.

Changelog

[General] [Fixed] - Add Jest mock for Vibration module

Test Plan

I would be glad to provide a test plan for this, but as it is part of testing I don't really know how to do so.
Any suggestion or help is welcome!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 24, 2020
@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Dec 24, 2020

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: a0a45dc
Branch: main

@dulmandakh
Copy link
Copy Markdown
Contributor

@hduprat could you please rebase so that CI are fixed

@hduprat hduprat force-pushed the jest/add-vibration-module-mock branch from 770c8d3 to a60f504 Compare January 5, 2021 08:26
@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Jan 5, 2021

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,775,893 +0
android hermes armeabi-v7a 7,181,339 +0
android hermes x86 8,084,900 +0
android hermes x86_64 8,065,067 +0
android jsc arm64-v8a 9,650,077 +0
android jsc armeabi-v7a 8,424,169 +0
android jsc x86 9,599,556 +0
android jsc x86_64 10,197,138 +0

Base commit: a0a45dc
Branch: main

@hduprat
Copy link
Copy Markdown
Contributor Author

hduprat commented Jan 5, 2021

@hduprat could you please rebase so that CI are fixed

@dulmandakh I did rebase but I still have one failing test. I currently don't know why

@dulmandakh dulmandakh requested a review from fkgozali January 6, 2021 01:56
@hduprat hduprat force-pushed the jest/add-vibration-module-mock branch from a60f504 to be92ce5 Compare May 3, 2022 11:47
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @hduprat in 79529a1.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label May 3, 2022
@hduprat hduprat deleted the jest/add-vibration-module-mock branch February 6, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants