mirror of
https://github.com/nasa/openmct.git
synced 2025-01-04 04:14:09 +00:00
Merge pull request #100 from nasa/open99
[Identity] Provide an undefined identity
This commit is contained in:
commit
dafcda281a
@ -30,20 +30,18 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var UNKNOWN_USER = {
|
|
||||||
key: "unknown",
|
|
||||||
name: "Unknown User"
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation of an identity service. Provides an
|
* Default implementation of an identity service. Provides an
|
||||||
* unkown user.
|
* unknown user as an `undefined` value; this is present simply
|
||||||
|
* to ensure that there is always an `identityService` available
|
||||||
|
* for platform components to use.
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @implements {IdentityService}
|
* @implements {IdentityService}
|
||||||
* @memberof platform/identity
|
* @memberof platform/identity
|
||||||
*/
|
*/
|
||||||
function IdentityProvider($q) {
|
function IdentityProvider($q) {
|
||||||
this.userPromise = $q.when(UNKNOWN_USER);
|
this.userPromise = $q.when(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentityProvider.prototype.getUser = function () {
|
IdentityProvider.prototype.getUser = function () {
|
||||||
|
@ -46,15 +46,12 @@ define(
|
|||||||
provider = new IdentityProvider(mockQ);
|
provider = new IdentityProvider(mockQ);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("provides an unknown user", function () {
|
it("provides an undefined user", function () {
|
||||||
provider.getUser().then(mockCallback);
|
provider.getUser().then(mockCallback);
|
||||||
|
|
||||||
waitsFor(calledBack);
|
waitsFor(calledBack);
|
||||||
runs(function () {
|
runs(function () {
|
||||||
expect(mockCallback).toHaveBeenCalledWith({
|
expect(mockCallback).toHaveBeenCalledWith(undefined);
|
||||||
key: jasmine.any(String),
|
|
||||||
name: jasmine.any(String)
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user