2020-07-16 23:09:14 -04:00
|
|
|
import createState from '~/integrations/edit/store/state';
|
|
|
|
|
|
|
|
describe('Integration form state factory', () => {
|
|
|
|
it('states default to null', () => {
|
|
|
|
expect(createState()).toEqual({
|
2020-09-17 05:09:32 -04:00
|
|
|
defaultState: null,
|
2020-07-16 23:09:14 -04:00
|
|
|
customState: {},
|
2020-09-15 14:09:43 -04:00
|
|
|
isSaving: false,
|
|
|
|
isTesting: false,
|
2020-11-16 10:09:23 -05:00
|
|
|
isResetting: false,
|
2020-07-16 23:09:14 -04:00
|
|
|
override: false,
|
2021-01-24 13:09:28 -05:00
|
|
|
isLoadingJiraIssueTypes: false,
|
|
|
|
jiraIssueTypes: [],
|
|
|
|
loadingJiraIssueTypesErrorMessage: '',
|
2020-07-16 23:09:14 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('override is initialized correctly', () => {
|
|
|
|
it.each([
|
|
|
|
[{ id: 25 }, { inheritFromId: null }, true],
|
|
|
|
[{ id: 25 }, { inheritFromId: 27 }, true],
|
|
|
|
[{ id: 25 }, { inheritFromId: 25 }, false],
|
|
|
|
[null, { inheritFromId: null }, false],
|
|
|
|
[null, { inheritFromId: 25 }, false],
|
|
|
|
])(
|
2020-09-17 05:09:32 -04:00
|
|
|
'for defaultState: %p, customState: %p: override = `%p`',
|
|
|
|
(defaultState, customState, expected) => {
|
|
|
|
expect(createState({ defaultState, customState }).override).toEqual(expected);
|
2020-07-16 23:09:14 -04:00
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|