Commit 594e8ae3 authored by Justin Ho's avatar Justin Ho

Add more specs for full coverage

parent 1c960d6a
......@@ -435,6 +435,29 @@ describe('IntegrationForm', () => {
});
},
);
describe('when IntegrationSectionConnection emits `request-jira-issue-types` event', () => {
beforeEach(() => {
jest.spyOn(document, 'querySelector').mockReturnValue(document.createElement('form'));
createComponent({
provide: {
glFeatures: { integrationFormSections: true },
},
customStateProps: {
sections: [mockSectionConnection],
testPath: '/test',
},
mountFn: mountExtended,
});
findConnectionSectionComponent().vm.$emit('request-jira-issue-types');
});
it('dispatches `requestJiraIssueTypes` action', () => {
expect(dispatch).toHaveBeenCalledWith('requestJiraIssueTypes', expect.any(FormData));
});
});
});
describe('ActiveCheckbox', () => {
......
......@@ -109,6 +109,32 @@ RSpec.describe Integrations::Jira do
end
end
describe '#sections' do
let(:integration) { create(:jira_integration) }
subject(:sections) { integration.sections.map { |s| s[:type] } }
context 'when project_level? is true' do
before do
allow(integration).to receive(:project_level?).and_return(true)
end
it 'includes SECTION_TYPE_JIRA_ISSUES' do
expect(sections).to include(described_class::SECTION_TYPE_JIRA_ISSUES)
end
end
context 'when project_level? is false' do
before do
allow(integration).to receive(:project_level?).and_return(false)
end
it 'does not include SECTION_TYPE_JIRA_ISSUES' do
expect(sections).not_to include(described_class::SECTION_TYPE_JIRA_ISSUES)
end
end
end
describe '.reference_pattern' do
using RSpec::Parameterized::TableSyntax
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment