diff --git a/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationsList.jsx b/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationList.jsx
similarity index 96%
rename from awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationsList.jsx
rename to awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationList.jsx
index 9402637fc2..dde9b1fb04 100644
--- a/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationsList.jsx
+++ b/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationList.jsx
@@ -18,7 +18,7 @@ const QS_CONFIG = getQSConfig('organizations', {
type: 'organization',
});
-function UserOrganizationsList() {
+function UserOrganizationList() {
const location = useLocation();
const { id: userId } = useParams();
@@ -77,4 +77,4 @@ function UserOrganizationsList() {
);
}
-export default UserOrganizationsList;
+export default UserOrganizationList;
diff --git a/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationsList.test.jsx b/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationList.test.jsx
similarity index 93%
rename from awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationsList.test.jsx
rename to awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationList.test.jsx
index 445878983d..c10abc18e2 100644
--- a/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationsList.test.jsx
+++ b/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationList.test.jsx
@@ -7,7 +7,7 @@ import {
waitForElement,
} from '../../../../testUtils/enzymeHelpers';
-import UserOrganizationsList from './UserOrganizationsList';
+import UserOrganizationList from './UserOrganizationList';
import { UsersAPI } from '../../../api';
jest.mock('../../../api/models/Users');
@@ -15,6 +15,7 @@ jest.mock('../../../api/models/Users');
describe('', () => {
let history;
let wrapper;
+
beforeEach(async () => {
history = createMemoryHistory({
initialEntries: ['/users/1/organizations'],
@@ -36,7 +37,7 @@ describe('', () => {
wrapper = mountWithContexts(
}
+ component={() => }
/>,
{
context: {
@@ -52,12 +53,15 @@ describe('', () => {
);
});
});
+
afterEach(() => {
jest.clearAllMocks();
});
+
test('successfully mounts', async () => {
await waitForElement(wrapper, 'UserOrganizationListItem');
});
+
test('calls api to get organizations', () => {
expect(UsersAPI.readOrganizations).toBeCalledWith('1', {
order_by: 'name',
diff --git a/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationListItem.test.jsx b/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationListItem.test.jsx
index 3a176a4a3c..672e196ad1 100644
--- a/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationListItem.test.jsx
+++ b/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizationListItem.test.jsx
@@ -9,9 +9,13 @@ describe('', () => {
let wrapper;
act(() => {
wrapper = mountWithContexts(
-
+
);
});
expect(wrapper.find('UserOrganizationListItem').length).toBe(1);
@@ -20,20 +24,24 @@ describe('', () => {
let wrapper;
act(() => {
wrapper = mountWithContexts(
-
+
);
});
expect(
wrapper
- .find('DataListCell')
+ .find('Td')
.at(0)
.text()
).toBe('foo');
expect(
wrapper
- .find('DataListCell')
+ .find('Td')
.at(1)
.text()
).toBe('Bar');
diff --git a/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizations.jsx b/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizations.jsx
index 1bd83ad2fa..b38127ec90 100644
--- a/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizations.jsx
+++ b/awx/ui_next/src/screens/User/UserOrganizations/UserOrganizations.jsx
@@ -1,7 +1,7 @@
import React from 'react';
-import UserOrganizationsList from './UserOrganizationsList';
+import UserOrganizationList from './UserOrganizationList';
function UserOrganizations() {
- return ;
+ return ;
}
export default UserOrganizations;
diff --git a/awx/ui_next/src/screens/User/UserRoles/UserRolesListItem.test.jsx b/awx/ui_next/src/screens/User/UserRoles/UserRolesListItem.test.jsx
index 21cd4b6974..70339f2f0f 100644
--- a/awx/ui_next/src/screens/User/UserRoles/UserRolesListItem.test.jsx
+++ b/awx/ui_next/src/screens/User/UserRoles/UserRolesListItem.test.jsx
@@ -19,63 +19,91 @@ describe('', () => {
};
test('should mount properly', () => {
wrapper = mountWithContexts(
-
+
);
expect(wrapper.length).toBe(1);
});
test('should render proper list item data', () => {
wrapper = mountWithContexts(
-
+
);
+ const cells = wrapper.find('Td');
+ expect(cells.at(0).text()).toBe('template delete project');
expect(
- wrapper.find('PFDataListCell[aria-label="Resource name"]').text()
- ).toBe('template delete project');
- expect(
- wrapper.find('PFDataListCell[aria-label="Resource type"]').text()
+ cells.at(1).text()
+ // wrapper.find('PFDataListCell[aria-label="Resource type"]').text()
).toContain('Job Template');
expect(
- wrapper.find('PFDataListCell[aria-label="Resource role"]').text()
+ cells.at(2).text()
+ // wrapper.find('PFDataListCell[aria-label="Resource role"]').text()
).toContain('Admin');
});
+
test('should render deletable chip', () => {
wrapper = mountWithContexts(
-
+
);
expect(wrapper.find('Chip').prop('isReadOnly')).toBe(false);
});
+
test('should render read only chip', () => {
role.summary_fields.user_capabilities.unattach = false;
wrapper = mountWithContexts(
-
+
);
expect(wrapper.find('Chip').prop('isReadOnly')).toBe(true);
});
+
test('should display System as name when no resource_name is present in summary_fields', () => {
wrapper = mountWithContexts(
-
+
);
expect(
- wrapper.find('PFDataListCell[aria-label="Resource name"]').text()
+ wrapper
+ .find('Td')
+ .at(0)
+ .text()
+ // wrapper.find('PFDataListCell[aria-label="Resource name"]').text()
).toBe('System');
});
});
diff --git a/awx/ui_next/src/screens/User/UserTeams/UserTeamListItem.test.jsx b/awx/ui_next/src/screens/User/UserTeams/UserTeamListItem.test.jsx
index 4e911e11ab..6abbf73d35 100644
--- a/awx/ui_next/src/screens/User/UserTeams/UserTeamListItem.test.jsx
+++ b/awx/ui_next/src/screens/User/UserTeams/UserTeamListItem.test.jsx
@@ -1,6 +1,4 @@
import React from 'react';
-import { MemoryRouter } from 'react-router-dom';
-import { I18nProvider } from '@lingui/react';
import { i18n } from '@lingui/core';
import { en } from 'make-plural/plurals';
import { mountWithContexts } from '../../../../testUtils/enzymeHelpers';
@@ -14,8 +12,8 @@ i18n.activate('en');
describe('', () => {
test('should render item', () => {
const wrapper = mountWithContexts(
-
-
+
+
', () => {
isSelected={false}
onSelect={() => {}}
/>
-
-
+
+
);
- const cells = wrapper.find('DataListCell');
- expect(cells).toHaveLength(3);
- expect(cells.at(0).text()).toEqual('Team 1');
- expect(cells.at(1).text()).toEqual('Organization The Org');
- expect(cells.at(2).text()).toEqual('something something team');
+ const cells = wrapper.find('Td');
+ expect(cells).toHaveLength(4);
+ expect(cells.at(1).text()).toEqual('Team 1');
+ expect(cells.at(2).text()).toEqual('The Org');
+ expect(cells.at(3).text()).toEqual('something something team');
});
});