2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-31 14:25:30 +00:00

Fix portal tests

This commit is contained in:
Ryan Emerle
2022-05-20 09:23:37 -04:00
parent e7643db419
commit 16b4dafd43
3 changed files with 8 additions and 5 deletions

View File

@@ -57,7 +57,7 @@ describe('Controller: GroupsController', function () {
groups: "all my groups"
}
};
var getGroups = spyOn(this.groupsService, 'getGroups')
var getGroups = spyOn(this.groupsService, 'getGroupsAbridged')
.and.stub()
.and.returnValue(this.q.when(response));

View File

@@ -55,6 +55,9 @@ angular.module('controller.zones', [])
groupsService.getGroupsAbridged(true, "").then(function (results) {
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.resetCurrentZone();

View File

@@ -37,12 +37,12 @@ describe('Controller: ZonesController', function () {
this.scope.zones = {};
profileService.getAuthenticatedUserData = function() {
return $q.when({data: {}});
return $q.when({data: {id: "userId"}});
};
groupsService.getGroups = function() {
groupsService.getGroupsAbridged = function () {
return $q.when({
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(){
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 () {