debian-mirror-gitlab/spec/frontend/integrations/edit/store/state_spec.js

32 lines
975 B
JavaScript
Raw Normal View History

2020-07-28 23:09:34 +05:30
import createState from '~/integrations/edit/store/state';
describe('Integration form state factory', () => {
it('states default to null', () => {
expect(createState()).toEqual({
2020-11-24 15:15:51 +05:30
defaultState: null,
2020-07-28 23:09:34 +05:30
customState: {},
2020-11-24 15:15:51 +05:30
isSaving: false,
2021-01-29 00:20:46 +05:30
isResetting: false,
2020-07-28 23:09:34 +05:30
override: false,
2021-03-11 19:13:27 +05:30
isLoadingJiraIssueTypes: false,
jiraIssueTypes: [],
loadingJiraIssueTypesErrorMessage: '',
2020-07-28 23:09:34 +05:30
});
});
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-11-24 15:15:51 +05:30
'for defaultState: %p, customState: %p: override = `%p`',
(defaultState, customState, expected) => {
expect(createState({ defaultState, customState }).override).toEqual(expected);
2020-07-28 23:09:34 +05:30
},
);
});
});