mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Improve flow typing and linting for MessageQueue
Differential Revision: D5987892 fbshipit-source-id: 8b9218875944decc5e21863e3c3f3a659ff2e2e4
This commit is contained in:
committed by
Facebook Github Bot
parent
1f8826815d
commit
7b575d669d
@@ -65,20 +65,20 @@ describe('MessageQueue', function() {
|
||||
it('should call the stored callback', () => {
|
||||
let done = false;
|
||||
queue.enqueueNativeCall(0, 1, [], () => {}, () => { done = true; });
|
||||
queue.__invokeCallback(1);
|
||||
queue.__invokeCallback(1, []);
|
||||
expect(done).toEqual(true);
|
||||
});
|
||||
|
||||
it('should throw when calling the same callback twice', () => {
|
||||
queue.enqueueNativeCall(0, 1, [], () => {}, () => {});
|
||||
queue.__invokeCallback(1);
|
||||
expect(() => queue.__invokeCallback(1)).toThrow();
|
||||
queue.__invokeCallback(1, []);
|
||||
expect(() => queue.__invokeCallback(1, [])).toThrow();
|
||||
});
|
||||
|
||||
it('should throw when calling both success and failure callback', () => {
|
||||
queue.enqueueNativeCall(0, 1, [], () => {}, () => {});
|
||||
queue.__invokeCallback(1);
|
||||
expect(() => queue.__invokeCallback(0)).toThrow();
|
||||
queue.__invokeCallback(1, []);
|
||||
expect(() => queue.__invokeCallback(0, [])).toThrow();
|
||||
});
|
||||
|
||||
it('should throw when calling with unknown module', () => {
|
||||
|
||||
Reference in New Issue
Block a user