mirror of
https://github.com/status-im/react-native.git
synced 2025-01-24 16:29:01 +00:00
Make a method used externaly (in a test) public
Summary: The method is being used in a test, so if a private method name mangling happens, the name of the method changes and the test fails. Reviewed By: cpojer Differential Revision: D5347967 fbshipit-source-id: ee964c2876bcfea5253d2ce7f9f02d4dbeebeab3
This commit is contained in:
parent
c42080eaaf
commit
1d7c990424
@ -153,7 +153,7 @@ class MessageQueue {
|
||||
};
|
||||
}
|
||||
|
||||
_getCallableModule(name: string) {
|
||||
getCallableModule(name: string) {
|
||||
const getValue = this._lazyCallableModules[name];
|
||||
return getValue ? getValue() : null;
|
||||
}
|
||||
@ -252,7 +252,7 @@ class MessageQueue {
|
||||
if (this.__spy) {
|
||||
this.__spy({ type: TO_JS, module, method, args});
|
||||
}
|
||||
const moduleMethods = this._getCallableModule(module);
|
||||
const moduleMethods = this.getCallableModule(module);
|
||||
invariant(
|
||||
!!moduleMethods,
|
||||
'Module %s is not a registered callable module (calling %s)',
|
||||
|
@ -91,7 +91,8 @@ describe('MessageQueue', function() {
|
||||
it('should return lazily registered module', () => {
|
||||
const dummyModule = {}, name = 'modulesName';
|
||||
queue.registerLazyCallableModule(name, () => dummyModule);
|
||||
expect(queue._getCallableModule(name)).toEqual(dummyModule);
|
||||
|
||||
expect(queue.getCallableModule(name)).toEqual(dummyModule);
|
||||
});
|
||||
|
||||
it('should not initialize lazily registered module before it was used for the first time', () => {
|
||||
@ -105,8 +106,8 @@ describe('MessageQueue', function() {
|
||||
const dummyModule = {}, name = 'modulesName';
|
||||
const factory = jest.fn(() => dummyModule);
|
||||
queue.registerLazyCallableModule(name, factory);
|
||||
queue._getCallableModule(name);
|
||||
queue._getCallableModule(name);
|
||||
queue.getCallableModule(name);
|
||||
queue.getCallableModule(name);
|
||||
expect(factory).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user