mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 05:59:28 -02:30
Updates stale copy pasta. Org -> Team
This commit is contained in:
@@ -9,12 +9,12 @@ jest.mock('@api');
|
|||||||
describe('<TeamAdd />', () => {
|
describe('<TeamAdd />', () => {
|
||||||
test('handleSubmit should post to api', () => {
|
test('handleSubmit should post to api', () => {
|
||||||
const wrapper = mountWithContexts(<TeamAdd />);
|
const wrapper = mountWithContexts(<TeamAdd />);
|
||||||
const updatedOrgData = {
|
const updatedTeamData = {
|
||||||
name: 'new name',
|
name: 'new name',
|
||||||
description: 'new description',
|
description: 'new description',
|
||||||
};
|
};
|
||||||
wrapper.find('TeamForm').prop('handleSubmit')(updatedOrgData);
|
wrapper.find('TeamForm').prop('handleSubmit')(updatedTeamData);
|
||||||
expect(TeamsAPI.create).toHaveBeenCalledWith(updatedOrgData);
|
expect(TeamsAPI.create).toHaveBeenCalledWith(updatedTeamData);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should navigate to teams list when cancel is clicked', () => {
|
test('should navigate to teams list when cancel is clicked', () => {
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ describe('<TeamDetail />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should hide edit button for users without edit permission', async done => {
|
test('should hide edit button for users without edit permission', async done => {
|
||||||
const readOnlyOrg = { ...mockTeam };
|
const readOnlyTeam = { ...mockTeam };
|
||||||
readOnlyOrg.summary_fields.user_capabilities.edit = false;
|
readOnlyTeam.summary_fields.user_capabilities.edit = false;
|
||||||
const wrapper = mountWithContexts(<TeamDetail team={readOnlyOrg} />);
|
const wrapper = mountWithContexts(<TeamDetail team={readOnlyTeam} />);
|
||||||
await waitForElement(wrapper, 'TeamDetail');
|
await waitForElement(wrapper, 'TeamDetail');
|
||||||
expect(wrapper.find('TeamDetail Button').length).toBe(0);
|
expect(wrapper.find('TeamDetail Button').length).toBe(0);
|
||||||
done();
|
done();
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ describe('<TeamEdit />', () => {
|
|||||||
test('handleSubmit should call api update', () => {
|
test('handleSubmit should call api update', () => {
|
||||||
const wrapper = mountWithContexts(<TeamEdit team={mockData} />);
|
const wrapper = mountWithContexts(<TeamEdit team={mockData} />);
|
||||||
|
|
||||||
const updatedOrgData = {
|
const updatedTeamData = {
|
||||||
name: 'new name',
|
name: 'new name',
|
||||||
description: 'new description',
|
description: 'new description',
|
||||||
};
|
};
|
||||||
wrapper.find('TeamForm').prop('handleSubmit')(updatedOrgData);
|
wrapper.find('TeamForm').prop('handleSubmit')(updatedTeamData);
|
||||||
|
|
||||||
expect(TeamsAPI.update).toHaveBeenCalledWith(1, updatedOrgData);
|
expect(TeamsAPI.update).toHaveBeenCalledWith(1, updatedTeamData);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should navigate to team detail when cancel is clicked', () => {
|
test('should navigate to team detail when cancel is clicked', () => {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class TeamForm extends Component {
|
|||||||
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
||||||
<FormRow>
|
<FormRow>
|
||||||
<FormField
|
<FormField
|
||||||
id="org-name"
|
id="team-name"
|
||||||
name="name"
|
name="name"
|
||||||
type="text"
|
type="text"
|
||||||
label={i18n._(t`Name`)}
|
label={i18n._(t`Name`)}
|
||||||
@@ -58,7 +58,7 @@ class TeamForm extends Component {
|
|||||||
isRequired
|
isRequired
|
||||||
/>
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
id="org-description"
|
id="team-description"
|
||||||
name="description"
|
name="description"
|
||||||
type="text"
|
type="text"
|
||||||
label={i18n._(t`Description`)}
|
label={i18n._(t`Description`)}
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ describe('<TeamForm />', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const form = wrapper.find('Formik');
|
const form = wrapper.find('Formik');
|
||||||
wrapper.find('input#org-name').simulate('change', {
|
wrapper.find('input#team-name').simulate('change', {
|
||||||
target: { value: 'new foo', name: 'name' },
|
target: { value: 'new foo', name: 'name' },
|
||||||
});
|
});
|
||||||
expect(form.state('values').name).toEqual('new foo');
|
expect(form.state('values').name).toEqual('new foo');
|
||||||
wrapper.find('input#org-description').simulate('change', {
|
wrapper.find('input#team-description').simulate('change', {
|
||||||
target: { value: 'new bar', name: 'description' },
|
target: { value: 'new bar', name: 'description' },
|
||||||
});
|
});
|
||||||
expect(form.state('values').description).toEqual('new bar');
|
expect(form.state('values').description).toEqual('new bar');
|
||||||
|
|||||||
Reference in New Issue
Block a user