-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix PassportProfileMapper.prototype.getNameIdentifier won't return email
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
var expect = require('chai').expect; | ||
var PassportProfileMapper = require('../lib/claims/PassportProfileMapper') | ||
|
||
describe('PassportProfileMapper', function () { | ||
it('PassportProfileMapper.prototype.getNameIdentifier returns id', function() { | ||
var profileMapper = new PassportProfileMapper({ | ||
'id': 'e9f7ac44-3f9c-488c-88a2-5b4b437749a9', | ||
'emails': [], | ||
'displayName': null, | ||
'name': { | ||
'familyName': null, | ||
'givenName': null, | ||
} | ||
}) | ||
var output = profileMapper.getNameIdentifier() | ||
expect(output.nameIdentifier).to.eql('e9f7ac44-3f9c-488c-88a2-5b4b437749a9') | ||
}) | ||
|
||
it('PassportProfileMapper.prototype.getNameIdentifier returns name', function() { | ||
var profileMapper = new PassportProfileMapper({ | ||
'id': null, | ||
'emails': [], | ||
'displayName': 'Curious George', | ||
'name': { | ||
'familyName': null, | ||
'givenName': null, | ||
} | ||
}) | ||
var output = profileMapper.getNameIdentifier() | ||
expect(output.nameIdentifier).to.eql('Curious George') | ||
}) | ||
|
||
it('PassportProfileMapper.prototype.getNameIdentifier returns emails', function() { | ||
var profileMapper = new PassportProfileMapper({ | ||
'id': null, | ||
'emails': [{ | ||
'value': '[email protected]' | ||
}], | ||
'displayName': null, | ||
'name': { | ||
'familyName': null, | ||
'givenName': null, | ||
} | ||
}) | ||
var output = profileMapper.getNameIdentifier() | ||
expect(output.nameIdentifier).to.eql('[email protected]') | ||
}) | ||
|
||
it('PassportProfileMapper.prototype.getNameIdentifier returns undefined', function() { | ||
var profileMapper = new PassportProfileMapper({ | ||
'id': null, | ||
'emails': [], | ||
'displayName': null, | ||
'name': { | ||
'familyName': 'Curious George', | ||
'givenName': 'George', | ||
} | ||
}) | ||
var output = profileMapper.getNameIdentifier() | ||
expect(output.nameIdentifier).to.eql(undefined) | ||
}) | ||
}) |