mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-27 08:54:32 +00:00
Fix tests for dataset health and create health mirage api handler
This commit is contained in:
parent
4206c75387
commit
db227ac0fd
@ -25,6 +25,7 @@ import { aclAuth } from 'wherehows-web/mirage/helpers/aclauth';
|
||||
import { getDatasetUpstreams } from 'wherehows-web/mirage/helpers/dataset-upstreams';
|
||||
import { getDatasetRetention } from 'wherehows-web/mirage/helpers/dataset-retentions';
|
||||
import { getDatasetFabrics } from 'wherehows-web/mirage/helpers/dataset-fabrics';
|
||||
import { getDatasetHealth } from 'wherehows-web/mirage/helpers/dataset-health';
|
||||
|
||||
export default function(this: IMirageServer) {
|
||||
this.get('/config', getConfig);
|
||||
@ -57,6 +58,8 @@ export default function(this: IMirageServer) {
|
||||
|
||||
this.get('/datasets/:dataset_id/fabrics', getDatasetFabrics);
|
||||
|
||||
this.get('/datasets/:dataset_id/health', getDatasetHealth);
|
||||
|
||||
this.namespace = '/api/v1';
|
||||
|
||||
this.get('/datasets/:dataset_id', getDataset);
|
||||
|
||||
9
wherehows-web/mirage/helpers/dataset-health.ts
Normal file
9
wherehows-web/mirage/helpers/dataset-health.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { IFunctionRouteHandler } from 'wherehows-web/typings/ember-cli-mirage';
|
||||
|
||||
export const getDatasetHealth = function(this: IFunctionRouteHandler, { health }: any, request: any) {
|
||||
const { dataset_id } = request.params;
|
||||
|
||||
return {
|
||||
health: health.filter((score: any) => score.refDatasetUrn === dataset_id)[0] || null
|
||||
};
|
||||
};
|
||||
@ -1,13 +1,20 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { moduleForComponent, test } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { waitUntil, find } from 'ember-native-dom-helpers';
|
||||
import { urn } from 'wherehows-web/mirage/fixtures/urn';
|
||||
import sinon from 'sinon';
|
||||
|
||||
module('Integration | Component | datasets/containers/dataset-health', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
// TODO: More meaningful tests as we continue with development
|
||||
test('it renders', async function(assert) {
|
||||
await render(hbs`{{datasets/containers/dataset-health}}`);
|
||||
assert.ok(this.element, 'Renders without errors');
|
||||
});
|
||||
moduleForComponent(
|
||||
'datasets/containers/dataset-health',
|
||||
'Integration | Component | datasets/containers/dataset-health',
|
||||
{
|
||||
integration: true
|
||||
}
|
||||
);
|
||||
|
||||
test('it renders', async function(assert) {
|
||||
this.set('urn', urn);
|
||||
this.render(hbs`{{datasets/containers/dataset-health urn=urn}}`);
|
||||
|
||||
assert.ok(find('.dataset-health__score-table'), 'renders the health table component');
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user