mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-26 17:45:30 +00:00
adds integration tests for upstream and downstream containers
This commit is contained in:
parent
51d45b177b
commit
3a95fd27ec
@ -27,6 +27,7 @@ import { getDatasetRetention } from 'wherehows-web/mirage/helpers/dataset-retent
|
|||||||
import { getDatasetFabrics } from 'wherehows-web/mirage/helpers/dataset-fabrics';
|
import { getDatasetFabrics } from 'wherehows-web/mirage/helpers/dataset-fabrics';
|
||||||
import { getDatasetHealth } from 'wherehows-web/mirage/helpers/dataset-health';
|
import { getDatasetHealth } from 'wherehows-web/mirage/helpers/dataset-health';
|
||||||
import { getDatasetCount } from 'wherehows-web/mirage/helpers/dataset-count';
|
import { getDatasetCount } from 'wherehows-web/mirage/helpers/dataset-count';
|
||||||
|
import { getDatasetDownstreams } from 'wherehows-web/mirage/helpers/dataset-downstreams';
|
||||||
|
|
||||||
export default function(this: IMirageServer) {
|
export default function(this: IMirageServer) {
|
||||||
this.get('/config', getConfig);
|
this.get('/config', getConfig);
|
||||||
@ -53,6 +54,8 @@ export default function(this: IMirageServer) {
|
|||||||
|
|
||||||
this.get('/datasets/:dataset_id/upstreams', getDatasetUpstreams);
|
this.get('/datasets/:dataset_id/upstreams', getDatasetUpstreams);
|
||||||
|
|
||||||
|
this.get('/datasets/:dataset_id/downstreams', getDatasetDownstreams);
|
||||||
|
|
||||||
this.get('/datasets/:dataset_id/retention', getDatasetRetention);
|
this.get('/datasets/:dataset_id/retention', getDatasetRetention);
|
||||||
|
|
||||||
this.get('/datasets/:dataset_id/compliance', getDatasetCompliance);
|
this.get('/datasets/:dataset_id/compliance', getDatasetCompliance);
|
||||||
|
7
wherehows-web/mirage/helpers/dataset-downstreams.ts
Normal file
7
wherehows-web/mirage/helpers/dataset-downstreams.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { IFunctionRouteHandler } from 'wherehows-web/typings/ember-cli-mirage';
|
||||||
|
|
||||||
|
const getDatasetDownstreams = function(this: IFunctionRouteHandler, { datasetViews }: { datasetViews: any }) {
|
||||||
|
return this.serialize(datasetViews.all());
|
||||||
|
};
|
||||||
|
|
||||||
|
export { getDatasetDownstreams };
|
@ -0,0 +1,60 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { setupRenderingTest } from 'ember-qunit';
|
||||||
|
import { render, findAll } from '@ember/test-helpers';
|
||||||
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
|
import { nonHdfsUrn } from 'wherehows-web/mirage/fixtures/urn';
|
||||||
|
import { startMirage } from 'wherehows-web/initializers/ember-cli-mirage';
|
||||||
|
|
||||||
|
module('Integration | Component | datasets/containers/dataset-lineage-downstreams', function(hooks) {
|
||||||
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
|
hooks.beforeEach(function(this: any) {
|
||||||
|
this.server = startMirage();
|
||||||
|
});
|
||||||
|
|
||||||
|
hooks.afterEach(function(this: any) {
|
||||||
|
this.server.shutdown();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('component rendering', async function(assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
|
||||||
|
this.set('urn', nonHdfsUrn);
|
||||||
|
|
||||||
|
await render(hbs`
|
||||||
|
{{#datasets/containers/dataset-lineage-downstreams urn=urn}}
|
||||||
|
nested container content
|
||||||
|
{{/datasets/containers/dataset-lineage-downstreams}}
|
||||||
|
`);
|
||||||
|
|
||||||
|
assert.ok(this.element, 'expect component to be rendered in DOM');
|
||||||
|
assert.equal(
|
||||||
|
this.element.textContent!.trim(),
|
||||||
|
'nested container content',
|
||||||
|
'expect container to render nested content'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('component yielding with a urn', async function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
const { server }: any = this;
|
||||||
|
const downstreamCount = 4;
|
||||||
|
|
||||||
|
server.createList('datasetView', downstreamCount);
|
||||||
|
|
||||||
|
this.set('urn', nonHdfsUrn);
|
||||||
|
|
||||||
|
await render(hbs`
|
||||||
|
{{#datasets/containers/dataset-lineage-downstreams urn=urn as |container|}}
|
||||||
|
<ul class="container-list">
|
||||||
|
{{#each container.downstreams}}
|
||||||
|
<li></li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/datasets/containers/dataset-lineage-downstreams}}
|
||||||
|
`);
|
||||||
|
|
||||||
|
assert.equal(findAll('.container-list li')!.length, downstreamCount, 'expect component to yield downstreams');
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,64 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { setupRenderingTest } from 'ember-qunit';
|
||||||
|
import { render, findAll } from '@ember/test-helpers';
|
||||||
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
|
import { startMirage } from 'wherehows-web/initializers/ember-cli-mirage';
|
||||||
|
import { nonHdfsUrn } from 'wherehows-web/mirage/fixtures/urn';
|
||||||
|
|
||||||
|
module('Integration | Component | datasets/containers/dataset-lineage-upstreams', function(hooks) {
|
||||||
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
|
hooks.beforeEach(function(this: any) {
|
||||||
|
this.server = startMirage();
|
||||||
|
});
|
||||||
|
|
||||||
|
hooks.afterEach(function(this: any) {
|
||||||
|
this.server.shutdown();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('component rendering', async function(assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
|
||||||
|
this.set('urn', nonHdfsUrn);
|
||||||
|
|
||||||
|
await render(hbs`
|
||||||
|
{{#datasets/containers/dataset-lineage-upstreams urn=urn}}
|
||||||
|
nested container content
|
||||||
|
{{/datasets/containers/dataset-lineage-upstreams}}
|
||||||
|
`);
|
||||||
|
|
||||||
|
assert.ok(this.element, 'expect component to be rendered in DOM');
|
||||||
|
assert.equal(
|
||||||
|
this.element.textContent!.trim(),
|
||||||
|
'nested container content',
|
||||||
|
'expect container to render nested content'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('component yielding with a urn', async function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
const { server }: any = this;
|
||||||
|
const upstreamCount = 3;
|
||||||
|
|
||||||
|
server.createList('datasetView', upstreamCount);
|
||||||
|
|
||||||
|
this.set('urn', nonHdfsUrn);
|
||||||
|
|
||||||
|
await render(hbs`
|
||||||
|
{{#datasets/containers/dataset-lineage-upstreams urn=urn as |container|}}
|
||||||
|
<ul class="container-list">
|
||||||
|
{{#each container.upstreams}}
|
||||||
|
<li></li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/datasets/containers/dataset-lineage-upstreams}}
|
||||||
|
`);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
findAll('.container-list li')!.length,
|
||||||
|
upstreamCount,
|
||||||
|
'expect component to yield each upstream dataset'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user