| 
									
										
										
										
											2018-02-21 09:46:04 -08:00
										 |  |  | import { moduleForComponent, test } from 'ember-qunit'; | 
					
						
							|  |  |  | import hbs from 'htmlbars-inline-precompile'; | 
					
						
							|  |  |  | import { waitUntil, find } from 'ember-native-dom-helpers'; | 
					
						
							|  |  |  | import { urn } from 'wherehows-web/mirage/fixtures/urn'; | 
					
						
							|  |  |  | import sinon from 'sinon'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | moduleForComponent( | 
					
						
							|  |  |  |   'datasets/containers/dataset-ownership', | 
					
						
							|  |  |  |   'Integration | Component | datasets/containers/dataset ownership', | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     integration: true, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     beforeEach() { | 
					
						
							|  |  |  |       this.server = sinon.createFakeServer(); | 
					
						
							|  |  |  |       this.server.respondImmediately = true; | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     afterEach() { | 
					
						
							|  |  |  |       this.server.restore(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test('it renders', async function(assert) { | 
					
						
							| 
									
										
										
										
											2018-04-22 23:31:35 -07:00
										 |  |  |   const lookupClass = '.dataset-owner-table__add-owner'; | 
					
						
							| 
									
										
										
										
											2018-02-21 09:46:04 -08:00
										 |  |  |   this.set('urn', urn); | 
					
						
							|  |  |  |   this.server.respondWith('GET', /\/api\/v2\/datasets.*/, [ | 
					
						
							|  |  |  |     200, | 
					
						
							|  |  |  |     { 'Content-Type': 'application/json' }, | 
					
						
							|  |  |  |     JSON.stringify({}) | 
					
						
							|  |  |  |   ]); | 
					
						
							|  |  |  |   this.server.respondWith('GET', '/api/v1/owner/types', [ | 
					
						
							|  |  |  |     200, | 
					
						
							|  |  |  |     { 'Content-Type': 'application/json' }, | 
					
						
							|  |  |  |     JSON.stringify([]) | 
					
						
							|  |  |  |   ]); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-20 16:02:13 -07:00
										 |  |  |   this.render(hbs`{{datasets/containers/dataset-ownership urn=urn}}`); | 
					
						
							| 
									
										
										
										
											2018-02-21 09:46:04 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   await waitUntil(() => find(lookupClass)); | 
					
						
							|  |  |  |   assert.equal( | 
					
						
							|  |  |  |     document.querySelector(lookupClass).textContent.trim(), | 
					
						
							| 
									
										
										
										
											2018-04-22 23:31:35 -07:00
										 |  |  |     'Add an owner', | 
					
						
							| 
									
										
										
										
											2018-02-21 09:46:04 -08:00
										 |  |  |     'shows dataset authors component' | 
					
						
							|  |  |  |   ); | 
					
						
							|  |  |  | }); |