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:
Miguel Jimenez Esun 2017-07-03 07:44:38 -07:00 committed by Facebook Github Bot
parent c42080eaaf
commit 1d7c990424
2 changed files with 6 additions and 5 deletions

View File

@ -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)',

View File

@ -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);
});
});