2020-07-17 03:09:14 +00:00
|
|
|
import createState from '~/integrations/edit/store/state';
|
|
|
|
|
|
|
|
describe('Integration form state factory', () => {
|
|
|
|
it('states default to null', () => {
|
|
|
|
expect(createState()).toEqual({
|
2020-09-17 09:09:32 +00:00
|
|
|
defaultState: null,
|
2020-07-17 03:09:14 +00:00
|
|
|
customState: {},
|
2020-09-15 18:09:43 +00:00
|
|
|
isSaving: false,
|
|
|
|
isTesting: false,
|
2020-11-16 15:09:23 +00:00
|
|
|
isResetting: false,
|
2020-07-17 03:09:14 +00:00
|
|
|
override: false,
|
2021-01-24 18:09:28 +00:00
|
|
|
isLoadingJiraIssueTypes: false,
|
|
|
|
jiraIssueTypes: [],
|
|
|
|
loadingJiraIssueTypesErrorMessage: '',
|
2020-07-17 03:09:14 +00: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 09:09:32 +00:00
|
|
|
'for defaultState: %p, customState: %p: override = `%p`',
|
|
|
|
(defaultState, customState, expected) => {
|
|
|
|
expect(createState({ defaultState, customState }).override).toEqual(expected);
|
2020-07-17 03:09:14 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|