mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-18 06:06:55 +00:00
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render, waitUntil, find } from '@ember/test-helpers';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import { urn } from 'wherehows-web/mirage/fixtures/urn';
|
|
import sinon from 'sinon';
|
|
|
|
module('Integration | Component | datasets/containers/dataset ownership', function(hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
hooks.beforeEach(function() {
|
|
this.sinonServer = sinon.createFakeServer();
|
|
this.sinonServer.respondImmediately = true;
|
|
});
|
|
|
|
hooks.afterEach(function() {
|
|
this.sinonServer.restore();
|
|
});
|
|
|
|
test('it renders', async function(assert) {
|
|
const lookupClass = '.dataset-owner-table__add-owner';
|
|
this.set('urn', urn);
|
|
this.sinonServer.respondWith('GET', /\/api\/v2\/datasets.*/, [
|
|
200,
|
|
{ 'Content-Type': 'application/json' },
|
|
JSON.stringify({})
|
|
]);
|
|
this.sinonServer.respondWith('GET', '/api/v1/owner/types', [
|
|
200,
|
|
{ 'Content-Type': 'application/json' },
|
|
JSON.stringify([])
|
|
]);
|
|
|
|
await render(hbs`{{datasets/containers/dataset-ownership urn=urn}}`);
|
|
|
|
await waitUntil(() => find(lookupClass));
|
|
assert.equal(
|
|
document.querySelector(lookupClass).textContent.trim(),
|
|
'Add an owner',
|
|
'shows dataset authors component'
|
|
);
|
|
});
|
|
});
|