2018-08-09 10:41:52 -07:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
2018-08-09 23:25:55 -07:00
|
|
|
import { render, waitUntil, find } from '@ember/test-helpers';
|
2018-03-12 17:35:01 -07:00
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
import { hdfsUrn } from 'wherehows-web/mirage/fixtures/urn';
|
|
|
|
import sinon from 'sinon';
|
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
module('Integration | Component | datasets/containers/upstream owners', function(hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
hooks.beforeEach(function() {
|
2018-08-30 15:54:14 -07:00
|
|
|
this.sinonServer = sinon.createFakeServer();
|
|
|
|
this.sinonServer.respondImmediately = true;
|
2018-08-09 10:41:52 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
hooks.afterEach(function() {
|
2018-08-30 15:54:14 -07:00
|
|
|
this.sinonServer.restore();
|
2018-03-12 17:35:01 -07:00
|
|
|
});
|
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
test('it renders', async function(assert) {
|
|
|
|
const titleElementQuery = '.upstream-owners-banner__title strong';
|
|
|
|
const nativeName = 'A nativeName';
|
2018-03-12 17:35:01 -07:00
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
this.set('upstreamUrn', hdfsUrn);
|
2018-08-30 15:54:14 -07:00
|
|
|
this.sinonServer.respondWith(/\/api\/v2\/datasets.*/, async function(xhr) {
|
2018-08-09 10:41:52 -07:00
|
|
|
xhr.respond(
|
|
|
|
200,
|
|
|
|
{ 'Content-Type': 'application/json' },
|
|
|
|
JSON.stringify({
|
|
|
|
dataset: {
|
|
|
|
nativeName
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
});
|
2018-03-12 17:35:01 -07:00
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
await render(hbs`{{datasets/containers/upstream-owners upstreamUrn=upstreamUrn}}`);
|
|
|
|
|
|
|
|
await waitUntil(() => find(titleElementQuery));
|
|
|
|
|
|
|
|
assert.equal(find(titleElementQuery).textContent.trim(), nativeName);
|
|
|
|
});
|
2018-03-12 17:35:01 -07:00
|
|
|
});
|