Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui - display all domains that reference current user #2789

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/src/__tests__/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Fetchr Client API Test', () => {
describe('listUserDomains test', () => {
it('listUserDomains test success', async () => {
myDataService = {
name: 'domain-list',
name: 'domain-role-member',
read: function (req, resource, params, config, callback) {
callback(null, DATA);
},
Expand All @@ -39,7 +39,7 @@ describe('Fetchr Client API Test', () => {
});
it('listUserDomains test error', async () => {
myDataServiceErr = {
name: 'domain-list',
name: 'domain-role-member',
read: function (req, resource, params, config, callback) {
callback({}, null);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ import {
} from '../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../mock/MockApi';
import { waitFor } from '@testing-library/react';
import { listUserDomains_response } from '../../../../mock/MockData';

afterEach(() => {
MockApi.cleanMockApi();
});

describe('DomainSettingsPage', () => {
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -63,7 +61,7 @@ describe('DomainSettingsPage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
};
Expand Down
6 changes: 2 additions & 4 deletions ui/src/__tests__/pages/domain/[domain]/group.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
mockAllDomainDataApiCalls,
renderWithRedux,
} from '../../../../tests_utils/ComponentsTestUtils';
import { listUserDomains_response } from '../../../../mock/MockData';

afterEach(() => {
MockApi.cleanMockApi();
Expand All @@ -34,9 +35,6 @@ describe('GroupPage', () => {
});
afterEach(() => MockApi.cleanMockApi());
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -69,7 +67,7 @@ describe('GroupPage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getGroups: jest.fn().mockReturnValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ import {
renderWithRedux,
} from '../../../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../../../mock/MockApi';
import { listUserDomains_response } from '../../../../../../mock/MockData';

afterEach(() => {
MockApi.cleanMockApi();
});

describe('GroupMemberPage', () => {
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -67,7 +65,7 @@ describe('GroupMemberPage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getDomainRoleMembers: jest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
renderWithRedux,
} from '../../../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../../../mock/MockApi';
import { listUserDomains_response } from '../../../../../../mock/MockData';

describe('GroupReviewPage', () => {
beforeEach(() => {
Expand All @@ -30,9 +31,6 @@ describe('GroupReviewPage', () => {
});
afterEach(() => MockApi.cleanMockApi());
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -69,7 +67,7 @@ describe('GroupReviewPage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getGroup: jest.fn().mockReturnValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ import {
mockAllDomainDataApiCalls,
renderWithRedux,
} from '../../../../../../tests_utils/ComponentsTestUtils';
import { listUserDomains_response } from '../../../../../../mock/MockData';

afterEach(() => {
MockApi.cleanMockApi();
});

describe('GroupRolesPage', () => {
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -66,7 +64,7 @@ describe('GroupRolesPage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getGroup: jest.fn().mockReturnValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
mockAllDomainDataApiCalls,
renderWithRedux,
} from '../../../../../../tests_utils/ComponentsTestUtils';
import { listUserDomains_response } from '../../../../../../mock/MockData';

afterEach(() => {
MockApi.cleanMockApi();
Expand All @@ -29,9 +30,6 @@ afterEach(() => {
describe('GroupSettingPage', () => {
it('should render', async () => {
let group = 'groupName';
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -70,7 +68,7 @@ describe('GroupSettingPage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getGroup: jest.fn().mockReturnValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
configApiGroups,
singleApiGroup,
} from '../../../../../redux/config/group.test';
import { listUserDomains_response } from '../../../../../../mock/MockData';

describe('Groups Tag Page', () => {
afterEach(() => {
Expand All @@ -34,9 +35,6 @@ describe('Groups Tag Page', () => {
const query = {
domain: 'dom',
};
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
const userId = 'test';
const domain = 'home.test';
const domainDetails = {
Expand Down Expand Up @@ -77,7 +75,7 @@ describe('Groups Tag Page', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getGroup: jest.fn().mockReturnValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ import {
renderWithRedux,
} from '../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../mock/MockApi';
import { listUserDomains_response } from '../../../../mock/MockData';

afterEach(() => {
MockApi.cleanMockApi();
});

describe('MicrosegmentationPage', () => {
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -65,7 +63,7 @@ describe('MicrosegmentationPage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getPolicies: jest.fn().mockReturnValue(
Expand Down
6 changes: 2 additions & 4 deletions ui/src/__tests__/pages/domain/[domain]/policy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
renderWithRedux,
} from '../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../mock/MockApi';
import { listUserDomains_response } from '../../../../mock/MockData';

afterEach(() => {
MockApi.cleanMockApi();
Expand All @@ -38,9 +39,6 @@ describe('PolicyPage', () => {
const query = {
domain: 'dom',
};
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
const userId = 'pgote';
const domain = 'home.pgote';
const domainDetails = {
Expand Down Expand Up @@ -74,7 +72,7 @@ describe('PolicyPage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getPolicies: jest.fn().mockReturnValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ import {
singleStorePolicy,
} from '../../../../../redux/config/policy.test';
import { storeDomainData } from '../../../../../redux/config/domainData.test';
import { listUserDomains_response } from '../../../../../../mock/MockData';

describe('Policies Tag Page', () => {
afterEach(() => {
MockApi.cleanMockApi();
});
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
const userId = 'test';
const domainDetails = {
description: 'test',
Expand Down Expand Up @@ -73,7 +71,7 @@ describe('Policies Tag Page', () => {
.mockReturnValue(Promise.resolve(apiPolicies)),
listUserDomains: jest
.fn()
.mockReturnValue(Promise.resolve(domains)),
.mockReturnValue(Promise.resolve(listUserDomains_response)),
getReviewGroups: jest.fn().mockReturnValue([]),
getReviewRoles: jest.fn().mockReturnValue([]),
getPageFeatureFlag: jest.fn().mockResolvedValue({}),
Expand Down
6 changes: 2 additions & 4 deletions ui/src/__tests__/pages/domain/[domain]/role.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ import {
renderWithRedux,
} from '../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../mock/MockApi';
import { listUserDomains_response } from '../../../../mock/MockData';

afterEach(() => {
MockApi.cleanMockApi();
});

describe('RolePage', () => {
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -70,7 +68,7 @@ describe('RolePage', () => {
),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getReviewGroups: jest.fn().mockReturnValue([]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ import {
renderWithRedux,
} from '../../../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../../../mock/MockApi';
import { listUserDomains_response } from '../../../../../../mock/MockData';

describe('MemberPage', () => {
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -67,7 +65,7 @@ describe('MemberPage', () => {
...mockRolesApiCalls(),
listUserDomains: jest.fn().mockReturnValue(
new Promise((resolve, reject) => {
resolve(domains);
resolve(listUserDomains_response);
})
),
getDomain: jest.fn().mockReturnValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ import {
renderWithRedux,
} from '../../../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../../../mock/MockApi';
import { listUserDomains_response } from '../../../../../../mock/MockData';

describe('RolePolicyPage', () => {
afterEach(() => {
MockApi.cleanMockApi();
});
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -68,7 +66,7 @@ describe('RolePolicyPage', () => {
getRole: jest.fn().mockReturnValue(Promise.resolve(roleDetails)),
listUserDomains: jest
.fn()
.mockReturnValue(Promise.resolve(domains)),
.mockReturnValue(Promise.resolve(listUserDomains_response)),
getReviewGroups: jest.fn().mockReturnValue([]),
getReviewRoles: jest.fn().mockReturnValue([]),
getPageFeatureFlag: jest.fn().mockResolvedValue({}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ import {
renderWithRedux,
} from '../../../../../../tests_utils/ComponentsTestUtils';
import MockApi from '../../../../../../mock/MockApi';
import { listUserDomains_response } from '../../../../../../mock/MockData';

describe('ReviewPage', () => {
afterEach(() => {
MockApi.cleanMockApi();
});
it('should render', async () => {
let domains = [];
domains.push({ name: 'athens' });
domains.push({ name: 'athens.ci' });
let query = {
domain: 'dom',
};
Expand Down Expand Up @@ -68,7 +66,7 @@ describe('ReviewPage', () => {
getRole: jest.fn().mockReturnValue(Promise.resolve(roleDetails)),
listUserDomains: jest
.fn()
.mockReturnValue(Promise.resolve(domains)),
.mockReturnValue(Promise.resolve(listUserDomains_response)),
getReviewGroups: jest.fn().mockReturnValue([]),
getReviewRoles: jest.fn().mockReturnValue([]),
getPageFeatureFlag: jest.fn().mockResolvedValue({}),
Expand Down
Loading
Loading