mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Fix org team link url
This commit is contained in:
@@ -30,7 +30,9 @@ function OrganizationTeams({ id, i18n }) {
|
|||||||
data: { count = 0, results = [] },
|
data: { count = 0, results = [] },
|
||||||
} = await OrganizationsAPI.readTeams(id, params);
|
} = await OrganizationsAPI.readTeams(id, params);
|
||||||
setItemCount(count);
|
setItemCount(count);
|
||||||
setTeams(results);
|
setTeams(
|
||||||
|
results.map(team => ({ ...team, url: `/teams/${team.id}/details` }))
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setContentError(error);
|
setContentError(error);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
|
|
||||||
import { OrganizationsAPI } from '@api';
|
import { OrganizationsAPI } from '@api';
|
||||||
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
import { mountWithContexts, waitForElement } from '@testUtils/enzymeHelpers';
|
||||||
import { sleep } from '@testUtils/testUtils';
|
import { sleep } from '@testUtils/testUtils';
|
||||||
|
|
||||||
import OrganizationTeams from './OrganizationTeams';
|
import OrganizationTeams from './OrganizationTeams';
|
||||||
@@ -65,7 +65,9 @@ describe('<OrganizationTeams />', () => {
|
|||||||
wrapper.update();
|
wrapper.update();
|
||||||
|
|
||||||
const list = wrapper.find('PaginatedDataList');
|
const list = wrapper.find('PaginatedDataList');
|
||||||
expect(list.prop('items')).toEqual(listData.data.results);
|
list.find('DataListCell').forEach((el, index) => {
|
||||||
|
expect(el.text()).toBe(listData.data.results[index].name);
|
||||||
|
});
|
||||||
expect(list.prop('itemCount')).toEqual(listData.data.count);
|
expect(list.prop('itemCount')).toEqual(listData.data.count);
|
||||||
expect(list.prop('qsConfig')).toEqual({
|
expect(list.prop('qsConfig')).toEqual({
|
||||||
namespace: 'team',
|
namespace: 'team',
|
||||||
@@ -78,4 +80,15 @@ describe('<OrganizationTeams />', () => {
|
|||||||
integerFields: ['page', 'page_size'],
|
integerFields: ['page', 'page_size'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should show content error for failed instance group fetch', async () => {
|
||||||
|
OrganizationsAPI.readTeams.mockImplementationOnce(() =>
|
||||||
|
Promise.reject(new Error())
|
||||||
|
);
|
||||||
|
let wrapper;
|
||||||
|
await act(async () => {
|
||||||
|
wrapper = mountWithContexts(<OrganizationTeams id={1} />);
|
||||||
|
});
|
||||||
|
await waitForElement(wrapper, 'ContentError', el => el.length === 1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user