From e35163872ba2928aa08a6203739a51635e94e9bc Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Wed, 13 Mar 2019 11:55:56 +0000 Subject: Removes EE differences for env store Creates helpers file Cleans up tests --- .../environments/environments_store_spec.js | 74 ++++++++++------------ 1 file changed, 33 insertions(+), 41 deletions(-) (limited to 'spec/javascripts/environments') diff --git a/spec/javascripts/environments/environments_store_spec.js b/spec/javascripts/environments/environments_store_spec.js index c3d16f10d72..8abdbcbbe54 100644 --- a/spec/javascripts/environments/environments_store_spec.js +++ b/spec/javascripts/environments/environments_store_spec.js @@ -34,54 +34,46 @@ describe('Store', () => { expect(store.state.stoppedCounter).toEqual(2); }); - describe('store environments', () => { - it('should store environments', () => { - store.storeEnvironments(serverData); - - expect(store.state.environments.length).toEqual(serverData.length); - }); - - it('should add folder keys when environment is a folder', () => { - const environment = { - name: 'bar', - size: 3, - id: 2, - }; + it('should add folder keys when environment is a folder', () => { + const environment = { + name: 'bar', + size: 3, + id: 2, + }; - store.storeEnvironments([environment]); + store.storeEnvironments([environment]); - expect(store.state.environments[0].isFolder).toEqual(true); - expect(store.state.environments[0].folderName).toEqual('bar'); - }); - - it('should extract content of `latest` key when provided', () => { - const environment = { - name: 'bar', - size: 3, - id: 2, - latest: { - last_deployment: {}, - isStoppable: true, - }, - }; - - store.storeEnvironments([environment]); + expect(store.state.environments[0].isFolder).toEqual(true); + expect(store.state.environments[0].folderName).toEqual('bar'); + }); - expect(store.state.environments[0].last_deployment).toEqual({}); - expect(store.state.environments[0].isStoppable).toEqual(true); - }); + it('should extract content of `latest` key when provided', () => { + const environment = { + name: 'bar', + size: 3, + id: 2, + latest: { + last_deployment: {}, + isStoppable: true, + }, + }; + + store.storeEnvironments([environment]); + + expect(store.state.environments[0].last_deployment).toEqual({}); + expect(store.state.environments[0].isStoppable).toEqual(true); + }); - it('should store latest.name when the environment is not a folder', () => { - store.storeEnvironments(serverData); + it('should store latest.name when the environment is not a folder', () => { + store.storeEnvironments(serverData); - expect(store.state.environments[0].name).toEqual(serverData[0].latest.name); - }); + expect(store.state.environments[0].name).toEqual(serverData[0].latest.name); + }); - it('should store root level name when environment is a folder', () => { - store.storeEnvironments(serverData); + it('should store root level name when environment is a folder', () => { + store.storeEnvironments(serverData); - expect(store.state.environments[1].folderName).toEqual(serverData[1].name); - }); + expect(store.state.environments[1].folderName).toEqual(serverData[1].name); }); describe('toggleFolder', () => { -- cgit v1.2.1