Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[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.
  • Loading branch information...
commit ac2fcf187191c131a897ca2980ba8ecf6aaa51e2 1 parent f4142e7
@mmocny mmocny authored
Showing with 15 additions and 15 deletions.
  1. +15 −15 test/android/test.exec.js
View
30 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]);
});
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.