You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/03/20 16:48:54 UTC

[10/40] js commit: [Android] Fixing failing jake tests

[Android] Fixing failing jake tests

Android jake tests were testing android's callbackFromNative arguments
are called with specific parameters.  The format changed slightly with
the recent MultiPart message type, so I had to update the tests.


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/ac2fcf18
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/ac2fcf18
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/ac2fcf18

Branch: refs/heads/cb2227
Commit: ac2fcf187191c131a897ca2980ba8ecf6aaa51e2
Parents: f4142e7
Author: Michal Mocny <mm...@gmail.com>
Authored: Mon Feb 25 13:55:09 2013 -0500
Committer: Michal Mocny <mm...@gmail.com>
Committed: Mon Feb 25 13:55:09 2013 -0500

----------------------------------------------------------------------
 test/android/test.exec.js |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ac2fcf18/test/android/test.exec.js
----------------------------------------------------------------------
diff --git a/test/android/test.exec.js b/test/android/test.exec.js
index 3363e45..3e185d9 100644
--- a/test/android/test.exec.js
+++ b/test/android/test.exec.js
@@ -107,50 +107,50 @@ describe('exec.processMessages', function () {
         it('should handle payloads of false', function() {
             var messages = createCallbackMessage(true, true, 1, 'id', 'f');
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, false, true);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [false], true);
         });
         it('should handle payloads of true', function() {
             var messages = createCallbackMessage(true, true, 1, 'id', 't');
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, true, true);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [true], true);
         });
         it('should handle payloads of null', function() {
             var messages = createCallbackMessage(true, true, 1, 'id', 'N');
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, null, true);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [null], true);
         });
         it('should handle payloads of numbers', function() {
             var messages = createCallbackMessage(true, true, 1, 'id', 'n-3.3');
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, -3.3, true);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [-3.3], true);
         });
         it('should handle payloads of strings', function() {
             var messages = createCallbackMessage(true, true, 1, 'id', 'sHello world');
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, 'Hello world', true);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, ['Hello world'], true);
         });
         it('should handle payloads of JSON objects', function() {
             var messages = createCallbackMessage(true, true, 1, 'id', '{"a":1}');
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, {a:1}, true);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [{a:1}], true);
         });
         it('should handle payloads of JSON arrays', function() {
             var messages = createCallbackMessage(true, true, 1, 'id', '[1]');
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [1], true);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [[1]], true);
         });
         it('should handle other callback opts', function() {
             var messages = createCallbackMessage(false, false, 3, 'id', 'sfoo');
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', false, 3, 'foo', false);
+            expect(callbackSpy).toHaveBeenCalledWith('id', false, 3, ['foo'], false);
         });
         it('should handle multiple messages', function() {
             var message1 = createCallbackMessage(false, false, 3, 'id', 'sfoo');
             var message2 = createCallbackMessage(true, true, 1, 'id', 'f');
             var messages = message1 + message2;
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', false, 3, 'foo', false);
-            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, false, true);
+            expect(callbackSpy).toHaveBeenCalledWith('id', false, 3, ['foo'], false);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [false], true);
         });
         it('should poll for more messages when hitting an *', function() {
             var message1 = createCallbackMessage(false, false, 3, 'id', 'sfoo');
@@ -161,10 +161,10 @@ describe('exec.processMessages', function () {
             });
             var messages = message1 + '*';
             exec.processMessages(messages);
-            expect(callbackSpy).toHaveBeenCalledWith('id', false, 3, 'foo', false);
+            expect(callbackSpy).toHaveBeenCalledWith('id', false, 3, ['foo'], false);
             waitsFor(function() { return nativeApi.retrieveJsMessages.wasCalled }, 500);
             runs(function() {
-                expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, false, true);
+                expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, [false], true);
             });
         });
         it('should call callbacks in order when one callback enqueues another.', function() {
@@ -179,9 +179,9 @@ describe('exec.processMessages', function () {
             });
             exec.processMessages(message1 + message2);
             expect(callbackSpy.argsForCall.length).toEqual(3);
-            expect(callbackSpy.argsForCall[0]).toEqual(['id', false, 3, 'call1', false]);
-            expect(callbackSpy.argsForCall[1]).toEqual(['id', false, 3, 'call2', false]);
-            expect(callbackSpy.argsForCall[2]).toEqual(['id', false, 3, 'call3', false]);
+            expect(callbackSpy.argsForCall[0]).toEqual(['id', false, 3, ['call1'], false]);
+            expect(callbackSpy.argsForCall[1]).toEqual(['id', false, 3, ['call2'], false]);
+            expect(callbackSpy.argsForCall[2]).toEqual(['id', false, 3, ['call3'], false]);
         });
     });
 });