Merge branch 'app-breadcrumb-tests'
This commit is contained in:
		
						commit
						f82a120317
					
				
					 4 changed files with 58 additions and 11 deletions
				
			
		|  | @ -40,11 +40,19 @@ export default { | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   computed: { |   computed: { | ||||||
|     selectedApplication: function () { |     selectedOrganisation: function () { | ||||||
|       if (!this.application) { |       if (!this.application) { | ||||||
|         return 'All' |         return 'All' | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |       return 'Rebuilding Acquia' | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     selectedApplication: function () { | ||||||
|  |       if (!this.application) { | ||||||
|  |         return null | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|       return this.application.name |       return this.application.name | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|  | @ -58,14 +66,6 @@ export default { | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       return this.environment.name |       return this.environment.name | ||||||
|     }, |  | ||||||
| 
 |  | ||||||
|     selectedOrganisation: function () { |  | ||||||
|       if (!this.application) { |  | ||||||
|         return null |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       return 'Rebuilding Acquia' |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -153,7 +153,7 @@ test('it can get the type of an application', () => { | ||||||
|     }, |     }, | ||||||
|     symfony: { |     symfony: { | ||||||
|       type: 'symfony' |       type: 'symfony' | ||||||
|     }, |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   _.forEach(applications, (application, expected) => { |   _.forEach(applications, (application, expected) => { | ||||||
|  |  | ||||||
							
								
								
									
										47
									
								
								tests/unit/app_breadcrumb.spec.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								tests/unit/app_breadcrumb.spec.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,47 @@ | ||||||
|  | import AppBreadcrumb from '@/components/AppBreadcrumb.vue' | ||||||
|  | import { RouterLinkStub, shallowMount } from '@vue/test-utils' | ||||||
|  | 
 | ||||||
|  | const stubs =  { | ||||||
|  |   RouterLink: RouterLinkStub | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | test('it returns default values', () => { | ||||||
|  |   const wrapper = shallowMount(AppBreadcrumb, { stubs }) | ||||||
|  | 
 | ||||||
|  |   expect(wrapper.vm.selectedOrganisation).toBe('All') | ||||||
|  |   expect(wrapper.vm.selectedApplication).toBe(null) | ||||||
|  |   expect(wrapper.vm.selectedEnvironment).toBe(null) | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | test('it returns the organisation and application names', () => { | ||||||
|  |   const wrapper = shallowMount(AppBreadcrumb, { | ||||||
|  |     propsData: { | ||||||
|  |       application: { | ||||||
|  |         name: 'Oliver Davies' | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     stubs | ||||||
|  |   }) | ||||||
|  | 
 | ||||||
|  |   expect(wrapper.vm.selectedOrganisation).toBe('Rebuilding Acquia') | ||||||
|  |   expect(wrapper.vm.selectedApplication).toBe('Oliver Davies') | ||||||
|  |   expect(wrapper.vm.selectedEnvironment).toBe('All') | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | test('it returns the environment name', () => { | ||||||
|  |   const wrapper = shallowMount(AppBreadcrumb, { | ||||||
|  |     propsData: { | ||||||
|  |       application: { | ||||||
|  |         name: 'Oliver Davies' | ||||||
|  |       }, | ||||||
|  |       environment: { | ||||||
|  |         name: 'Dev' | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     stubs | ||||||
|  |   }) | ||||||
|  | 
 | ||||||
|  |   expect(wrapper.vm.selectedOrganisation).toBe('Rebuilding Acquia') | ||||||
|  |   expect(wrapper.vm.selectedApplication).toBe('Oliver Davies') | ||||||
|  |   expect(wrapper.vm.selectedEnvironment).toBe('Dev') | ||||||
|  | }) | ||||||
		Reference in a new issue