diff --git a/wherehows-web/mirage/config.ts b/wherehows-web/mirage/config.ts index 86beb0a576..ec9dc06c94 100644 --- a/wherehows-web/mirage/config.ts +++ b/wherehows-web/mirage/config.ts @@ -27,6 +27,7 @@ import { getDatasetRetention } from 'wherehows-web/mirage/helpers/dataset-retent import { getDatasetFabrics } from 'wherehows-web/mirage/helpers/dataset-fabrics'; import { getDatasetHealth } from 'wherehows-web/mirage/helpers/dataset-health'; import { getDatasetCount } from 'wherehows-web/mirage/helpers/dataset-count'; +import { getDatasetDownstreams } from 'wherehows-web/mirage/helpers/dataset-downstreams'; export default function(this: IMirageServer) { 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/downstreams', getDatasetDownstreams); + this.get('/datasets/:dataset_id/retention', getDatasetRetention); this.get('/datasets/:dataset_id/compliance', getDatasetCompliance); diff --git a/wherehows-web/mirage/helpers/dataset-downstreams.ts b/wherehows-web/mirage/helpers/dataset-downstreams.ts new file mode 100644 index 0000000000..2597e9698f --- /dev/null +++ b/wherehows-web/mirage/helpers/dataset-downstreams.ts @@ -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 }; diff --git a/wherehows-web/tests/integration/components/datasets/containers/dataset-lineage-downstreams-test.ts b/wherehows-web/tests/integration/components/datasets/containers/dataset-lineage-downstreams-test.ts new file mode 100644 index 0000000000..deece60951 --- /dev/null +++ b/wherehows-web/tests/integration/components/datasets/containers/dataset-lineage-downstreams-test.ts @@ -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|}} +