summaryrefslogtreecommitdiff
path: root/spec/javascripts/pipelines/nav_controls_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/pipelines/nav_controls_spec.js')
-rw-r--r--spec/javascripts/pipelines/nav_controls_spec.js37
1 files changed, 24 insertions, 13 deletions
diff --git a/spec/javascripts/pipelines/nav_controls_spec.js b/spec/javascripts/pipelines/nav_controls_spec.js
index 77c5258f74c..d6232f5c567 100644
--- a/spec/javascripts/pipelines/nav_controls_spec.js
+++ b/spec/javascripts/pipelines/nav_controls_spec.js
@@ -39,19 +39,6 @@ describe('Pipelines Nav Controls', () => {
expect(component.$el.querySelector('.js-run-pipeline')).toEqual(null);
});
- it('should render link for resetting runner caches', () => {
- const mockData = {
- newPipelinePath: 'foo',
- ciLintPath: 'foo',
- resetCachePath: 'foo',
- };
-
- component = mountComponent(NavControlsComponent, mockData);
-
- expect(component.$el.querySelector('.js-clear-cache').textContent.trim()).toContain('Clear Runner Caches');
- expect(component.$el.querySelector('.js-clear-cache').getAttribute('href')).toEqual(mockData.resetCachePath);
- });
-
it('should render link for CI lint', () => {
const mockData = {
newPipelinePath: 'foo',
@@ -65,4 +52,28 @@ describe('Pipelines Nav Controls', () => {
expect(component.$el.querySelector('.js-ci-lint').textContent.trim()).toContain('CI Lint');
expect(component.$el.querySelector('.js-ci-lint').getAttribute('href')).toEqual(mockData.ciLintPath);
});
+
+ describe('Reset Runners Cache', () => {
+ beforeEach(() => {
+ const mockData = {
+ newPipelinePath: 'foo',
+ ciLintPath: 'foo',
+ resetCachePath: 'foo',
+ };
+
+ component = mountComponent(NavControlsComponent, mockData);
+ });
+
+ it('should render button for resetting runner caches', () => {
+ expect(component.$el.querySelector('.js-clear-cache').textContent.trim()).toContain('Clear Runner Caches');
+ });
+
+ it('should emit postAction event when reset runner cache button is clicked', () => {
+ spyOn(component, '$emit');
+
+ component.$el.querySelector('.js-clear-cache').click();
+
+ expect(component.$emit).toHaveBeenCalledWith('resetRunnersCache', 'foo');
+ });
+ });
});