Skip to content

Commit

Permalink
add email (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitrii Rybakov authored and fleg committed Sep 1, 2017
1 parent cd822dc commit de71052
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/profile.js
Expand Up @@ -19,7 +19,10 @@ exports.parse = function profileParser(json) {

profile.gender = json.gender;
profile.profileUrl = 'https://odnoklassniki.ru/profile/' + profile.id;
profile.emails = [];

if (json.email) {
profile.emails = [{value: json.email}];
}

profile.photos = [];

Expand Down
5 changes: 3 additions & 2 deletions test/profile.js
Expand Up @@ -103,7 +103,7 @@ describe('Profile', function() {
last_name: 'Surname',
name: 'Name Surname',
gender: 'male',
has_email: true,
email: 'hey@arnold.com',
pic_1: 'http://i113.odnoklassniki.ru/getImage?photoId=93412337&photoType=4',
pic_2: 'http://i342.odnoklassniki.ru/getImage?photoId=93412337&photoType=2'
},
Expand All @@ -127,7 +127,8 @@ describe('Profile', function() {
expect(profile.gender).to.eql(profileData.gender);
expect(profile.profileUrl)
.to.eql('https://odnoklassniki.ru/profile/' + profile.id);
expect(profile.emails).to.have.length(0);
expect(profile.emails).to.have.length(1);
expect(profile.emails).to.eql([{value: profileData.email}]);

expect(profile.photos).to.have.length(2);
expect(profile.photos[0].value).to.eql(profileData.pic_1);
Expand Down

0 comments on commit de71052

Please sign in to comment.