[ReactNative] Fix MessageQueue-test on open source

Summary:
@public

Fix mocking on MessageQueue-test

Test Plan: Run the test
This commit is contained in:
Tadeu Zagallo 2015-06-18 15:56:33 -01:00
parent 9998337220
commit cf0e40ad3d
2 changed files with 7 additions and 11 deletions

View File

@ -8,9 +8,12 @@
*/
'use strict';
jest.dontMock('MessageQueue');
jest.setMock('ReactUpdates', {
batchedUpdates: fn => fn()
});
var ReactUpdates = require('ReactUpdates');
jest.dontMock('MessageQueue');
jest.dontMock('keyMirror');
var MessageQueue = require('MessageQueue');
let MODULE_IDS = 0;
@ -95,10 +98,6 @@ describe('MessageQueue', () => {
describe('processBatch', () => {
beforeEach(() => {
ReactUpdates.batchedUpdates = (fn) => fn();
});
it('should call __invokeCallback for invokeCallbackAndReturnFlushedQueue', () => {
queue.__invokeCallback = jasmine.createSpy();
queue.processBatch([{

View File

@ -18,16 +18,13 @@ module.exports = {
transformSource: transformSource,
process: function(src, fileName) {
if (fileName.match(/node_modules/)) {
return src;
}
try {
return transformSource(src, fileName);
} catch(e) {
throw new Error('\nError transforming file:\n js/' +
console.error('\nError transforming file:\n js/' +
(fileName.split('/js/')[1] || fileName) + ':' + e.lineNumber + ': \'' +
e.message + '\'\n');
return src;
}
}
};