2014-09-18 10:59:04 -06:00
|
|
|
describe("UserCtrl", function() {
|
|
|
|
var scope, ctrl, matrixService, routeParams, $q, $timeout;
|
|
|
|
var userId = "@foo:bar";
|
|
|
|
var displayName = "Foo";
|
|
|
|
var avatarUrl = "avatar.url";
|
|
|
|
|
|
|
|
beforeEach(module('matrixWebClient'));
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
|
|
|
|
inject(function($rootScope, $injector, $controller, _$q_, _$timeout_) {
|
|
|
|
$q = _$q_;
|
|
|
|
$timeout = _$timeout_;
|
|
|
|
|
|
|
|
matrixService = {
|
|
|
|
config: function() {
|
|
|
|
return {
|
|
|
|
user_id: userId
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
getDisplayName: function(uid) {
|
|
|
|
var d = $q.defer();
|
|
|
|
d.resolve({
|
|
|
|
data: {
|
|
|
|
displayname: displayName
|
|
|
|
}
|
|
|
|
});
|
2014-09-22 07:29:12 -06:00
|
|
|
return d.promise;
|
2014-09-18 10:59:04 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
getProfilePictureUrl: function(uid) {
|
|
|
|
var d = $q.defer();
|
|
|
|
d.resolve({
|
|
|
|
data: {
|
|
|
|
avatar_url: avatarUrl
|
|
|
|
}
|
|
|
|
});
|
2014-09-22 07:29:12 -06:00
|
|
|
return d.promise;
|
2014-09-18 10:59:04 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
scope = $rootScope.$new();
|
|
|
|
routeParams = {
|
|
|
|
user_matrix_id: userId
|
|
|
|
};
|
|
|
|
ctrl = $controller('UserController', {
|
|
|
|
'$scope': scope,
|
|
|
|
'$routeParams': routeParams,
|
|
|
|
'matrixService': matrixService
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should display your user id', function() {
|
|
|
|
expect(scope.user_id).toEqual(userId);
|
|
|
|
});
|
|
|
|
});
|