diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 17:02:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 17:02:45 +0300 |
commit | 80f61b4035607d7cd87de993b8f5e996bde3481f (patch) | |
tree | 06b12f51e97d87192e3dd0e05edf55143645b894 /spec/frontend/clusters/clusters_bundle_spec.js | |
parent | 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/clusters/clusters_bundle_spec.js')
-rw-r--r-- | spec/frontend/clusters/clusters_bundle_spec.js | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/spec/frontend/clusters/clusters_bundle_spec.js b/spec/frontend/clusters/clusters_bundle_spec.js index 80816faa5fc..517d8781600 100644 --- a/spec/frontend/clusters/clusters_bundle_spec.js +++ b/spec/frontend/clusters/clusters_bundle_spec.js @@ -11,6 +11,8 @@ import { loadHTMLFixture } from 'helpers/fixtures'; import { setTestTimeout } from 'helpers/timeout'; import $ from 'jquery'; +jest.mock('~/lib/utils/poll'); + const { INSTALLING, INSTALLABLE, INSTALLED, UNINSTALLING } = APPLICATION_STATUS; describe('Clusters', () => { @@ -44,6 +46,17 @@ describe('Clusters', () => { mock.restore(); }); + describe('class constructor', () => { + beforeEach(() => { + jest.spyOn(Clusters.prototype, 'initPolling'); + cluster = new Clusters(); + }); + + it('should call initPolling on construct', () => { + expect(cluster.initPolling).toHaveBeenCalled(); + }); + }); + describe('toggle', () => { it('should update the button and the input field on click', done => { const toggleButton = document.querySelector( @@ -327,14 +340,31 @@ describe('Clusters', () => { }); }); - describe('handleSuccess', () => { + describe('fetch cluster environments success', () => { + beforeEach(() => { + jest.spyOn(cluster.store, 'toggleFetchEnvironments').mockReturnThis(); + jest.spyOn(cluster.store, 'updateEnvironments').mockReturnThis(); + + cluster.handleClusterEnvironmentsSuccess({ data: {} }); + }); + + it('toggles the cluster environments loading icon', () => { + expect(cluster.store.toggleFetchEnvironments).toHaveBeenCalled(); + }); + + it('updates the store when cluster environments is retrieved', () => { + expect(cluster.store.updateEnvironments).toHaveBeenCalled(); + }); + }); + + describe('handleClusterStatusSuccess', () => { beforeEach(() => { jest.spyOn(cluster.store, 'updateStateFromServer').mockReturnThis(); jest.spyOn(cluster, 'toggleIngressDomainHelpText').mockReturnThis(); jest.spyOn(cluster, 'checkForNewInstalls').mockReturnThis(); jest.spyOn(cluster, 'updateContainer').mockReturnThis(); - cluster.handleSuccess({ data: {} }); + cluster.handleClusterStatusSuccess({ data: {} }); }); it('updates clusters store', () => { |