Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
17
gaia/apps/communications/facebook/test/unit/.jshintrc
Executable file
17
gaia/apps/communications/facebook/test/unit/.jshintrc
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../../.jshintrc",
|
||||
"predef": [
|
||||
"assert",
|
||||
"suite",
|
||||
"test",
|
||||
"setup",
|
||||
"teardown",
|
||||
"suiteSetup",
|
||||
"suiteTeardown",
|
||||
"require",
|
||||
"requireApp",
|
||||
"sinon",
|
||||
"mocha",
|
||||
"loadBodyHTML"
|
||||
]
|
||||
}
|
||||
102
gaia/apps/communications/facebook/test/unit/facebook_connector_test.js
Executable file
102
gaia/apps/communications/facebook/test/unit/facebook_connector_test.js
Executable file
|
|
@ -0,0 +1,102 @@
|
|||
/* globals MockFbQuery, MockOauthflow*/
|
||||
'use strict';
|
||||
|
||||
require('/shared/js/contacts/import/facebook/fb_contact_utils.js');
|
||||
require('/shared/js/fb/fb_reader_utils.js');
|
||||
require('/shared/js/contacts/import/utilities/misc.js');
|
||||
require('/shared/js/contacts/import/facebook/fb_contact.js');
|
||||
require('/shared/js/contacts/import/facebook/facebook_connector.js');
|
||||
requireApp('communications/facebook/test/unit/mock_fb_graph_data.js');
|
||||
requireApp('communications/facebook/test/unit/mock_fb_query.js');
|
||||
requireApp('communications/contacts/test/unit/mock_oauthflow.js');
|
||||
|
||||
var realFbUtils,
|
||||
realOauthflow,
|
||||
subject;
|
||||
|
||||
if (!window.FacebookConnector) {
|
||||
window.FacebookConnector = null;
|
||||
}
|
||||
|
||||
if (!window.fb) {
|
||||
window.fb = null;
|
||||
}
|
||||
|
||||
if (!window.oauthflow) {
|
||||
window.oauthflow = null;
|
||||
}
|
||||
|
||||
suite('Facebook Connector Tests', function() {
|
||||
suiteSetup(function() {
|
||||
realFbUtils = window.fb.utils;
|
||||
window.fb.utils = MockFbQuery;
|
||||
|
||||
subject = window.FacebookConnector;
|
||||
|
||||
realOauthflow = window.oauthflow;
|
||||
window.oauthflow = MockOauthflow;
|
||||
});
|
||||
|
||||
|
||||
test('List all friends. Adapt data for showing', function(done) {
|
||||
subject.listAllContacts('fake_token', {
|
||||
success: function(data) {
|
||||
assert.isNotNull(data.data);
|
||||
assert.isTrue(Array.isArray(data.data));
|
||||
|
||||
var theData = data.data[0];
|
||||
var adapted = subject.adaptDataForShowing(theData);
|
||||
|
||||
assert.equal(adapted.givenName[0], 'Carlos Angel');
|
||||
assert.equal(adapted.familyName[0], 'Bureta');
|
||||
assert.equal(adapted.email1, 'ppburetaxyz@gmail.com');
|
||||
assert.equal(adapted.uid, 45677);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
test('List all friends. Adapt Data for Saving', function(done) {
|
||||
subject.listAllContacts('fake_token', {
|
||||
success: function(data) {
|
||||
assert.isNotNull(data.data);
|
||||
assert.isTrue(Array.isArray(data.data));
|
||||
|
||||
var theData = data.data[0];
|
||||
var adapted = subject.adaptDataForSaving(theData);
|
||||
|
||||
assert.equal(adapted.givenName[0], 'Carlos Angel');
|
||||
assert.equal(adapted.familyName[0], 'Bureta');
|
||||
|
||||
assert.equal(adapted.email[0].type[0], 'other');
|
||||
assert.equal(adapted.email[0].value, 'ppburetaxyz@gmail.com');
|
||||
|
||||
assert.equal(adapted.tel[0].type[0], 'other');
|
||||
assert.equal(adapted.tel[0].value, '+34609274801');
|
||||
|
||||
assert.equal(adapted.fbInfo.org[0], 'Telefonica');
|
||||
|
||||
assert.equal(adapted.fbInfo.adr[0].type[0], 'home');
|
||||
assert.equal(adapted.fbInfo.adr[0].locality, 'Valladolid');
|
||||
assert.equal(adapted.fbInfo.adr[0].region, 'Castilla y Leon');
|
||||
assert.equal(adapted.fbInfo.adr[0].countryName, 'Spain');
|
||||
|
||||
assert.equal(adapted.fbInfo.adr[1].type[0], 'current');
|
||||
assert.equal(adapted.fbInfo.adr[1].locality, 'Greater London');
|
||||
assert.equal(adapted.fbInfo.adr[1].region, 'London');
|
||||
assert.equal(adapted.fbInfo.adr[1].countryName, 'United Kingdom');
|
||||
|
||||
assert.equal(adapted.fbInfo.bday.getUTCMonth(), 11);
|
||||
assert.equal(adapted.fbInfo.bday.getUTCDate(), 3);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
suiteTeardown(function() {
|
||||
window.fb.utils = realFbUtils;
|
||||
window.oauthflow = realOauthflow;
|
||||
});
|
||||
});
|
||||
23
gaia/apps/communications/facebook/test/unit/mock_curtain.js
Executable file
23
gaia/apps/communications/facebook/test/unit/mock_curtain.js
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
/* exported MockCurtain */
|
||||
|
||||
var MockCurtain = {
|
||||
show: function() {
|
||||
return {
|
||||
update: function() {
|
||||
|
||||
},
|
||||
setTotal: function() {
|
||||
|
||||
},
|
||||
getValue: function() {
|
||||
|
||||
}
|
||||
};
|
||||
},
|
||||
hide: function() {
|
||||
|
||||
},
|
||||
hideMenu: function(){}
|
||||
};
|
||||
59
gaia/apps/communications/facebook/test/unit/mock_fb_graph_data.js
Executable file
59
gaia/apps/communications/facebook/test/unit/mock_fb_graph_data.js
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
/* exported MockFbGraphData */
|
||||
'use strict';
|
||||
|
||||
var MockFbGraphData = {
|
||||
data: [
|
||||
{
|
||||
'uid': 45677,
|
||||
'name': 'Carlos Angel Bureta',
|
||||
'first_name': 'Carlos',
|
||||
'last_name': 'Bureta',
|
||||
'pic_big':
|
||||
'http://profile.ak.fbcdn.net/hprofile-ak-ash3/49136_779462559_2920_n.jpg',
|
||||
'hometown_location': {
|
||||
'city': 'Valladolid',
|
||||
'state': 'Castilla y Leon',
|
||||
'country': 'Spain',
|
||||
'zip': '',
|
||||
'id': 108236755863231,
|
||||
'name': 'Valladolid, Spain'
|
||||
},
|
||||
'current_location': {
|
||||
'city': 'Greater London',
|
||||
'state': 'London',
|
||||
'country': 'United Kingdom',
|
||||
'zip': '',
|
||||
'id': 902104567293783,
|
||||
'name': 'London, United Kingdom'
|
||||
},
|
||||
'middle_name': 'Angel',
|
||||
'birthday_date': '12/03/1984',
|
||||
'email': 'ppburetaxyz@gmail.com',
|
||||
'profile_update_time': 1360140477,
|
||||
'work': [
|
||||
{
|
||||
'employer': {
|
||||
'id': 115396748472536,
|
||||
'name': 'Telefonica'
|
||||
}
|
||||
},
|
||||
{
|
||||
'employer': {
|
||||
'id': 129653317102827,
|
||||
'name': 'Telefonica I+D'
|
||||
}
|
||||
}
|
||||
],
|
||||
'phones': [
|
||||
{
|
||||
'country_code': '34',
|
||||
'number': '609274801',
|
||||
'type': 'cell',
|
||||
'phone_type': 'Mobile',
|
||||
'is_verified': true,
|
||||
'is_sms_enabled': false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
12
gaia/apps/communications/facebook/test/unit/mock_fb_query.js
Executable file
12
gaia/apps/communications/facebook/test/unit/mock_fb_query.js
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
/* global MockFbGraphData */
|
||||
/* exported MockFbQuery */
|
||||
'use strict';
|
||||
|
||||
var MockFbQuery = {
|
||||
runQuery: function(query, callbacks) {
|
||||
callbacks.success(MockFbGraphData);
|
||||
},
|
||||
getFriendPicture: function(uid, callbacks) {
|
||||
callbacks.success(null);
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue