2018-08-09 10:41:52 -07:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
import { render } from '@ember/test-helpers';
|
2018-02-21 09:46:04 -08:00
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
import { waitUntil, find } from 'ember-native-dom-helpers';
|
|
|
|
import { urn } from 'wherehows-web/mirage/fixtures/urn';
|
2018-05-22 13:58:46 -07:00
|
|
|
import { initialComplianceObjectFactory } from 'wherehows-web/constants';
|
2018-02-21 09:46:04 -08:00
|
|
|
import sinon from 'sinon';
|
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
module('Integration | Component | datasets/containers/dataset compliance', function(hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
2018-02-21 09:46:04 -08:00
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
hooks.beforeEach(function() {
|
|
|
|
this.server = sinon.createFakeServer();
|
|
|
|
});
|
2018-02-21 09:46:04 -08:00
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
hooks.afterEach(function() {
|
|
|
|
this.server.restore();
|
|
|
|
});
|
2018-02-21 09:46:04 -08:00
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
test('it renders', async function(assert) {
|
|
|
|
this.set('urn', urn);
|
|
|
|
this.server.respondWith('GET', /\/api\/v2\/datasets\/.*/, [
|
|
|
|
200,
|
|
|
|
{ 'Content-Type': 'application/json' },
|
|
|
|
JSON.stringify({
|
|
|
|
complianceInfo: initialComplianceObjectFactory(urn)
|
|
|
|
})
|
|
|
|
]);
|
|
|
|
this.server.respondWith(/.*\/compliance-data-types/, [
|
|
|
|
200,
|
|
|
|
{ 'Content-Type': 'application/json' },
|
|
|
|
JSON.stringify([])
|
|
|
|
]);
|
|
|
|
this.server.respondWith(/.*\/compliance\/suggestion/, [
|
|
|
|
200,
|
|
|
|
{ 'Content-Type': 'application/json' },
|
|
|
|
JSON.stringify({})
|
|
|
|
]);
|
|
|
|
this.server.respondWith(/.*\/schema/, [
|
|
|
|
200,
|
|
|
|
{ 'Content-Type': 'application/json' },
|
|
|
|
JSON.stringify({
|
|
|
|
schema: {
|
|
|
|
schemaless: false,
|
|
|
|
columns: [],
|
|
|
|
rawSchema: null,
|
|
|
|
keySchema: null
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]);
|
2018-02-21 09:46:04 -08:00
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
await render(hbs`{{datasets/containers/dataset-compliance urn=urn}}`);
|
|
|
|
this.server.respond();
|
2018-02-21 09:46:04 -08:00
|
|
|
|
2018-08-09 10:41:52 -07:00
|
|
|
await waitUntil(() => find('.compliance-container'));
|
|
|
|
assert.ok(document.querySelector('empty-state'), 'renders the empty state component');
|
|
|
|
});
|
2018-02-21 09:46:04 -08:00
|
|
|
});
|