Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed test
Browse files Browse the repository at this point in the history
YulNaumenko committed Apr 7, 2021
1 parent d734677 commit 4191635
Showing 1 changed file with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ describe('PagerDutyParamsFields renders', () => {
expect(wrapper.find('[data-test-subj="dedupKeyAddVariableButton"]').length > 0).toBeTruthy();
});

test('params select fields dont auto set values ', () => {
test('params select fields do not auto set values eventActionSelect', () => {
const actionParams = {};

const wrapper = mountWithIntl(
@@ -61,16 +61,32 @@ describe('PagerDutyParamsFields renders', () => {
index={0}
/>
);
expect(wrapper.find('[data-test-subj="severitySelect"]').length > 0).toBeTruthy();
expect(wrapper.find('[data-test-subj="severitySelect"]').first().prop('value')).toStrictEqual(
undefined
);
expect(wrapper.find('[data-test-subj="eventActionSelect"]').length > 0).toBeTruthy();
expect(
wrapper.find('[data-test-subj="eventActionSelect"]').first().prop('value')
).toStrictEqual(undefined);
});

test('params select fields do not auto set values severitySelect', () => {
const actionParams = {
eventAction: EventActionOptions.TRIGGER,
dedupKey: 'test',
};

const wrapper = mountWithIntl(
<PagerDutyParamsFields
actionParams={actionParams}
errors={{ summary: [], timestamp: [], dedupKey: [] }}
editAction={() => {}}
index={0}
/>
);
expect(wrapper.find('[data-test-subj="severitySelect"]').length > 0).toBeTruthy();
expect(wrapper.find('[data-test-subj="severitySelect"]').first().prop('value')).toStrictEqual(
undefined
);
});

test('only eventActionSelect is available as a payload params for PagerDuty Resolve event', () => {
const actionParams = {
eventAction: EventActionOptions.RESOLVE,
@@ -87,9 +103,12 @@ describe('PagerDutyParamsFields renders', () => {
);
expect(wrapper.find('[data-test-subj="dedupKeyInput"]').length > 0).toBeTruthy();
expect(wrapper.find('[data-test-subj="dedupKeyInput"]').first().prop('value')).toStrictEqual(
'resolve'
'test'
);
expect(wrapper.find('[data-test-subj="eventActionSelect"]').length > 0).toBeTruthy();
expect(
wrapper.find('[data-test-subj="eventActionSelect"]').first().prop('value')
).toStrictEqual('resolve');
expect(wrapper.find('[data-test-subj="dedupKeyInput"]').length > 0).toBeTruthy();
expect(wrapper.find('[data-test-subj="timestampInput"]').length > 0).toBeFalsy();
expect(wrapper.find('[data-test-subj="componentInput"]').length > 0).toBeFalsy();

0 comments on commit 4191635

Please sign in to comment.