Skip to content

Commit

Permalink
remove whitespace changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kertof authored and joshcanhelp committed Dec 6, 2019
1 parent e6cd1b4 commit cddf152
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"prettier.disableLanguages": [
"js"
],
"editor.formatOnSave": false
}
30 changes: 14 additions & 16 deletions lib/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,28 @@ function Profile(data, raw) {
};

if (data.emails) {
this.emails = data.emails.map(function(email) {
this.emails = data.emails.map(function (email) {
return { value: email };
});
} else if (data.email) {
this.emails = [
{
value: data.email
}
];
this.emails = [{
value: data.email
}];
}

//copy these fields
['picture', 'locale', 'nickname', 'gender', 'identities']
.filter(function(k) {
return k in data;
})
.forEach(
function(k) {
this[k] = data[k];
}.bind(this)
);
['picture',
'locale',
'nickname',
'gender',
'identities'].filter(function (k) {
return k in data;
}).forEach(function (k) {
this[k] = data[k];
}.bind(this));

this._json = data;
this._raw = raw;
}

module.exports = Profile;
module.exports = Profile;
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 18 additions & 16 deletions test/userprofile.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@ var auth0ProfileNoIdentites = require('./fixtures/auth0-example-profile-no-ident
var auth0OIDCProfile = require('./fixtures/auth0-oidc-example-profile');
var Profile = require('../lib/Profile');

describe('Profile', function() {
[auth0Profile, auth0ProfileNoIdentites, auth0OIDCProfile].forEach(function(
profile
) {
before(function() {
describe('Profile', function () {
[auth0Profile, auth0ProfileNoIdentites, auth0OIDCProfile].forEach(function(profile) {
before(function () {
this.profile = new Profile(profile);
});

[
['provider', 'google-oauth2'],
['id', 'google-oauth2|ddddd123123123'],
['user_id', 'google-oauth2|ddddd123123123'],
['displayName', 'José F. Romaniello']
].forEach(function(tuple) {
it('should map ' + tuple[0], function() {
this.profile[tuple[0]].should.eql(tuple[1]);
it('should map ' + tuple[0], function () {
this.profile[tuple[0]]
.should.eql(tuple[1]);
});
});

it('should map the name', function() {
this.profile.name.givenName.should.eql('José F.');
this.profile.name.familyName.should.eql('Romaniello');

it('should map the name', function () {
this.profile.name.givenName
.should.eql('José F.');
this.profile.name.familyName
.should.eql('Romaniello');
});

it('should map the emails', function() {
this.profile.emails[0].value.should.eql('[email protected]');

it('should map the emails', function () {
this.profile.emails[0]
.value.should.eql('[email protected]');
});
});
});
});

0 comments on commit cddf152

Please sign in to comment.