Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ranbena committed Jan 15, 2019
1 parent eddba62 commit 17b5311
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 48 deletions.
15 changes: 4 additions & 11 deletions client/app/components/queries/ScheduleDialog.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import React from 'react';
import { mount } from 'enzyme';
import { ScheduleDialog } from './ScheduleDialog';
import RefreshScheduleDefault from '../proptypes';

const defaultProps = {
show: true,
query: {
schedule: {
time: null,
until: null,
interval: null,
day_of_week: null,
},
},
schedule: RefreshScheduleDefault,
refreshOptions: [
60, 300, 600, // 1, 5 ,10 mins
3600, 36000, 82800, // 1, 10, 23 hours
Expand All @@ -23,12 +17,11 @@ const defaultProps = {
};

function getWrapper(schedule = {}, props = {}) {
const defaultSchedule = defaultProps.query.schedule;
props = Object.assign(
{},
defaultProps,
props,
{ query: { schedule: Object.assign({}, defaultSchedule, schedule) } },
{ schedule: Object.assign({}, RefreshScheduleDefault, schedule) },
);
return [mount(<ScheduleDialog {...props} />), props];
}
Expand Down Expand Up @@ -78,7 +71,7 @@ describe('ScheduleDialog', () => {
const [wrapper] = getWrapper({
interval: 1209600,
time: '22:15',
day_of_week: 2,
day_of_week: 'Monday',
});

test('Sets to correct interval', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,7 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Weeks 22:15 Tu
>
<RadioGroup
buttonStyle="outline"
defaultValue="Mon"
disabled={false}
onChange={[Function]}
size="medium"
Expand Down Expand Up @@ -1700,7 +1701,7 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Weeks 22:15 Tu
value="Mon"
>
<Radio
checked={false}
checked={true}
className="input"
disabled={false}
onChange={[Function]}
Expand All @@ -1709,10 +1710,10 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Weeks 22:15 Tu
value="Mon"
>
<label
className="input ant-radio-button-wrapper"
className="input ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<Checkbox
checked={false}
checked={true}
className=""
defaultChecked={false}
disabled={false}
Expand All @@ -1725,11 +1726,11 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Weeks 22:15 Tu
value="Mon"
>
<span
className="ant-radio-button"
className="ant-radio-button ant-radio-button-checked"
style={Object {}}
>
<input
checked={false}
checked={true}
className="ant-radio-button-input"
disabled={false}
onBlur={[Function]}
Expand Down Expand Up @@ -2375,7 +2376,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
onChange={[Function]}
showSearch={false}
transitionName="slide-up"
value={null}
>
<Select
allowClear={false}
Expand Down Expand Up @@ -2445,7 +2445,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
tags={false}
tokenSeparators={Array []}
transitionName="slide-up"
value={null}
>
<SelectTrigger
ariaId="test-uuid"
Expand Down Expand Up @@ -2478,11 +2477,7 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
}
showSearch={false}
transitionName="slide-up"
value={
Array [
null,
]
}
value={Array []}
visible={false}
>
<Trigger
Expand Down Expand Up @@ -2577,11 +2572,7 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
onMenuSelect={[Function]}
onPopupFocus={[Function]}
prefixCls="ant-select-dropdown"
value={
Array [
null,
]
}
value={Array []}
visible={false}
/>
}
Expand All @@ -2599,11 +2590,7 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
}
showSearch={false}
transitionName="slide-up"
value={
Array [
null,
]
}
value={Array []}
visible={false}
>
<div
Expand Down Expand Up @@ -2631,21 +2618,7 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
>
<div
className="ant-select-selection__rendered"
>
<div
className="ant-select-selection-selected-value"
key="value"
style={
Object {
"display": "block",
"opacity": 1,
}
}
title="Never"
>
Never
</div>
</div>
/>
<span
className="ant-select-arrow"
key="arrow"
Expand Down

0 comments on commit 17b5311

Please sign in to comment.