mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 11:20:39 -03:30
Updates stale copy pasta. Org -> Team
This commit is contained in:
parent
1e80b2e295
commit
6acd3c98b7
@ -9,12 +9,12 @@ jest.mock('@api');
|
||||
describe('<TeamAdd />', () => {
|
||||
test('handleSubmit should post to api', () => {
|
||||
const wrapper = mountWithContexts(<TeamAdd />);
|
||||
const updatedOrgData = {
|
||||
const updatedTeamData = {
|
||||
name: 'new name',
|
||||
description: 'new description',
|
||||
};
|
||||
wrapper.find('TeamForm').prop('handleSubmit')(updatedOrgData);
|
||||
expect(TeamsAPI.create).toHaveBeenCalledWith(updatedOrgData);
|
||||
wrapper.find('TeamForm').prop('handleSubmit')(updatedTeamData);
|
||||
expect(TeamsAPI.create).toHaveBeenCalledWith(updatedTeamData);
|
||||
});
|
||||
|
||||
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 => {
|
||||
const readOnlyOrg = { ...mockTeam };
|
||||
readOnlyOrg.summary_fields.user_capabilities.edit = false;
|
||||
const wrapper = mountWithContexts(<TeamDetail team={readOnlyOrg} />);
|
||||
const readOnlyTeam = { ...mockTeam };
|
||||
readOnlyTeam.summary_fields.user_capabilities.edit = false;
|
||||
const wrapper = mountWithContexts(<TeamDetail team={readOnlyTeam} />);
|
||||
await waitForElement(wrapper, 'TeamDetail');
|
||||
expect(wrapper.find('TeamDetail Button').length).toBe(0);
|
||||
done();
|
||||
|
||||
@ -22,13 +22,13 @@ describe('<TeamEdit />', () => {
|
||||
test('handleSubmit should call api update', () => {
|
||||
const wrapper = mountWithContexts(<TeamEdit team={mockData} />);
|
||||
|
||||
const updatedOrgData = {
|
||||
const updatedTeamData = {
|
||||
name: 'new name',
|
||||
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', () => {
|
||||
|
||||
@ -50,7 +50,7 @@ class TeamForm extends Component {
|
||||
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
||||
<FormRow>
|
||||
<FormField
|
||||
id="org-name"
|
||||
id="team-name"
|
||||
name="name"
|
||||
type="text"
|
||||
label={i18n._(t`Name`)}
|
||||
@ -58,7 +58,7 @@ class TeamForm extends Component {
|
||||
isRequired
|
||||
/>
|
||||
<FormField
|
||||
id="org-description"
|
||||
id="team-description"
|
||||
name="description"
|
||||
type="text"
|
||||
label={i18n._(t`Description`)}
|
||||
|
||||
@ -34,11 +34,11 @@ describe('<TeamForm />', () => {
|
||||
);
|
||||
|
||||
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' },
|
||||
});
|
||||
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' },
|
||||
});
|
||||
expect(form.state('values').description).toEqual('new bar');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user