mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 06:26:00 -03:30
add tests ensuring forms pass correct value to CodeEditor fields
This commit is contained in:
@@ -74,6 +74,10 @@ describe('<SmartInventoryEdit />', () => {
|
|||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should render CodeEditor field', () => {
|
||||||
|
expect(wrapper.find('CodeEditor').prop('value')).toEqual('---');
|
||||||
|
});
|
||||||
|
|
||||||
test('should fetch related instance groups on initial render', async () => {
|
test('should fetch related instance groups on initial render', async () => {
|
||||||
expect(InventoriesAPI.readInstanceGroups).toHaveBeenCalledTimes(1);
|
expect(InventoriesAPI.readInstanceGroups).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ describe('<InventoryForm />', () => {
|
|||||||
1
|
1
|
||||||
);
|
);
|
||||||
expect(wrapper.find('VariablesField[label="Variables"]').length).toBe(1);
|
expect(wrapper.find('VariablesField[label="Variables"]').length).toBe(1);
|
||||||
|
expect(wrapper.find('CodeEditor').prop('value')).toEqual('---');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should update form values', async () => {
|
test('should update form values', async () => {
|
||||||
|
|||||||
@@ -79,6 +79,33 @@ describe('<NotificationTemplateForm />', () => {
|
|||||||
).toEqual(defaultMessages);
|
).toEqual(defaultMessages);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should render custom messages fields', () => {
|
||||||
|
const wrapper = mountWithContexts(
|
||||||
|
<NotificationTemplateForm
|
||||||
|
template={{
|
||||||
|
...template,
|
||||||
|
messages: {
|
||||||
|
started: {
|
||||||
|
message: 'Started',
|
||||||
|
body: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
defaultMessages={defaultMessages}
|
||||||
|
detailUrl="/notification_templates/3/detail"
|
||||||
|
onSubmit={jest.fn()}
|
||||||
|
onCancel={jest.fn()}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
wrapper
|
||||||
|
.find('CodeEditor')
|
||||||
|
.at(0)
|
||||||
|
.prop('value')
|
||||||
|
).toEqual('Started');
|
||||||
|
});
|
||||||
|
|
||||||
test('should submit', async () => {
|
test('should submit', async () => {
|
||||||
const handleSubmit = jest.fn();
|
const handleSubmit = jest.fn();
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
|
|||||||
Reference in New Issue
Block a user