Skip to content

Commit

Permalink
[ReactNative] Fix MessageQueue-test on open source
Browse files Browse the repository at this point in the history
Summary:
@public

Fix mocking on MessageQueue-test

Test Plan: Run the test
  • Loading branch information
tadeuzagallo committed Jun 18, 2015
1 parent 9998337 commit cf0e40a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
11 changes: 5 additions & 6 deletions Libraries/Utilities/__tests__/MessageQueue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([{
Expand Down
7 changes: 2 additions & 5 deletions jestSupport/scriptPreprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
};

0 comments on commit cf0e40a

Please sign in to comment.