mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Prettier React Native Libraries
Reviewed By: sahrens Differential Revision: D7961488 fbshipit-source-id: 05f9b8b0b91ae77f9040a5321ccc18f7c3c1ce9a
This commit is contained in:
committed by
Facebook Github Bot
parent
1e2de71290
commit
d01ab66b47
@@ -4,14 +4,13 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @emails oncall+react_native
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
jest
|
||||
.mock('ErrorUtils')
|
||||
.mock('BatchedBridge');
|
||||
jest.mock('ErrorUtils').mock('BatchedBridge');
|
||||
|
||||
function expectToBeCalledOnce(fn) {
|
||||
expect(fn.mock.calls.length).toBe(1);
|
||||
@@ -31,11 +30,11 @@ describe('InteractionManager', () => {
|
||||
|
||||
InteractionManager.addListener(
|
||||
InteractionManager.Events.interactionStart,
|
||||
interactionStart
|
||||
interactionStart,
|
||||
);
|
||||
InteractionManager.addListener(
|
||||
InteractionManager.Events.interactionComplete,
|
||||
interactionComplete
|
||||
interactionComplete,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -168,7 +167,6 @@ describe('promise tasks', () => {
|
||||
sequenceId = 0;
|
||||
});
|
||||
|
||||
|
||||
it('should run a basic promise task', () => {
|
||||
const task1 = jest.fn(() => {
|
||||
expect(++sequenceId).toBe(1);
|
||||
@@ -183,8 +181,10 @@ describe('promise tasks', () => {
|
||||
const task1 = jest.fn(() => {
|
||||
expect(++sequenceId).toBe(1);
|
||||
return new Promise(resolve => {
|
||||
InteractionManager.runAfterInteractions({gen: task2, name: 'gen2'})
|
||||
.then(resolve);
|
||||
InteractionManager.runAfterInteractions({
|
||||
gen: task2,
|
||||
name: 'gen2',
|
||||
}).then(resolve);
|
||||
});
|
||||
});
|
||||
const task2 = jest.fn(() => {
|
||||
@@ -255,7 +255,7 @@ describe('promise tasks', () => {
|
||||
expectToBeCalledOnce(task2);
|
||||
});
|
||||
|
||||
const bigAsyncTest = (resolve) => {
|
||||
const bigAsyncTest = resolve => {
|
||||
jest.useRealTimers();
|
||||
|
||||
const task1 = createSequenceTask(1);
|
||||
@@ -264,8 +264,10 @@ describe('promise tasks', () => {
|
||||
return new Promise(resolve => {
|
||||
InteractionManager.runAfterInteractions(task3);
|
||||
setTimeout(() => {
|
||||
InteractionManager.runAfterInteractions({gen: task4, name: 'gen4'})
|
||||
.then(resolve);
|
||||
InteractionManager.runAfterInteractions({
|
||||
gen: task4,
|
||||
name: 'gen4',
|
||||
}).then(resolve);
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user