mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-31 22:35:19 +00:00
Fix portal tests
This commit is contained in:
@@ -57,7 +57,7 @@ describe('Controller: GroupsController', function () {
|
|||||||
groups: "all my groups"
|
groups: "all my groups"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var getGroups = spyOn(this.groupsService, 'getGroups')
|
var getGroups = spyOn(this.groupsService, 'getGroupsAbridged')
|
||||||
.and.stub()
|
.and.stub()
|
||||||
.and.returnValue(this.q.when(response));
|
.and.returnValue(this.q.when(response));
|
||||||
|
|
||||||
|
@@ -55,6 +55,9 @@ angular.module('controller.zones', [])
|
|||||||
|
|
||||||
groupsService.getGroupsAbridged(true, "").then(function (results) {
|
groupsService.getGroupsAbridged(true, "").then(function (results) {
|
||||||
if (results.data) {
|
if (results.data) {
|
||||||
|
// Get all groups where the group members include the current user
|
||||||
|
$scope.myGroups = results.data.groups.filter(grp => grp.members.findIndex(mem => mem.id === $scope.profile.id) >= 0);
|
||||||
|
$scope.myGroupIds = $scope.myGroups.map(grp => grp.id);
|
||||||
$scope.allGroups = results.data.groups;
|
$scope.allGroups = results.data.groups;
|
||||||
}
|
}
|
||||||
$scope.resetCurrentZone();
|
$scope.resetCurrentZone();
|
||||||
|
@@ -37,12 +37,12 @@ describe('Controller: ZonesController', function () {
|
|||||||
this.scope.zones = {};
|
this.scope.zones = {};
|
||||||
|
|
||||||
profileService.getAuthenticatedUserData = function() {
|
profileService.getAuthenticatedUserData = function() {
|
||||||
return $q.when({data: {}});
|
return $q.when({data: {id: "userId"}});
|
||||||
};
|
};
|
||||||
groupsService.getGroups = function() {
|
groupsService.getGroupsAbridged = function () {
|
||||||
return $q.when({
|
return $q.when({
|
||||||
data: {
|
data: {
|
||||||
groups: [{id: "all my groups"}]
|
groups: [{id: "all my groups", members: [{id: "userId"}]}]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -65,7 +65,7 @@ describe('Controller: ZonesController', function () {
|
|||||||
|
|
||||||
it('test that we properly get users groups when loading ZonesController', function(){
|
it('test that we properly get users groups when loading ZonesController', function(){
|
||||||
this.scope.$digest();
|
this.scope.$digest();
|
||||||
expect(this.scope.myGroups).toEqual([{id: "all my groups"}]);
|
expect(this.scope.myGroups).toEqual([{id: "all my groups", members: [{id: "userId"}]}]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('nextPageMyZones should call getZones with the correct parameters', function () {
|
it('nextPageMyZones should call getZones with the correct parameters', function () {
|
||||||
|
Reference in New Issue
Block a user