mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Fix org team link url
This commit is contained in:
parent
7d74999851
commit
9cb7b0902a
@ -30,7 +30,9 @@ function OrganizationTeams({ id, i18n }) {
|
||||
data: { count = 0, results = [] },
|
||||
} = await OrganizationsAPI.readTeams(id, params);
|
||||
setItemCount(count);
|
||||
setTeams(results);
|
||||
setTeams(
|
||||
results.map(team => ({ ...team, url: `/teams/${team.id}/details` }))
|
||||
);
|
||||
} catch (error) {
|
||||
setContentError(error);
|
||||
} finally {
|
||||
|
||||
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
import { OrganizationsAPI } from '@api';
|
||||
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||
import { mountWithContexts, waitForElement } from '@testUtils/enzymeHelpers';
|
||||
import { sleep } from '@testUtils/testUtils';
|
||||
|
||||
import OrganizationTeams from './OrganizationTeams';
|
||||
@ -65,7 +65,9 @@ describe('<OrganizationTeams />', () => {
|
||||
wrapper.update();
|
||||
|
||||
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('qsConfig')).toEqual({
|
||||
namespace: 'team',
|
||||
@ -78,4 +80,15 @@ describe('<OrganizationTeams />', () => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user