Charlie Tran 843a6c5bbb
feat(frontend): update datahub-web client UI code (#1806)
* Releases updated version of datahub-web client UI code

* Fix typo in yarn lock

* Change yarn lock to match yarn registry directories

* Previous commit missed some paths

* Even more changes to yarnlock missing in previous commit

* Include codegen file for typings

* Add files to get parity for datahub-web and current OS datahub-midtier

* Add in typo fix from previous commit - change to proper license

* Implement proper OS fix for person entity picture url

* Workarounds for open source DH issues

* Fixes institutional memory api and removes unopensourced tabs for datasets

* Fixes search dataset deprecation and user search issue as a result of changes

* Remove internal only options in the avatar menu
2020-08-26 15:44:50 -07:00

68 lines
2.5 KiB
TypeScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { settled, click } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { MirageTestContext } from '@datahub/utils/types/vendor/ember-cli-mirage/mirage-tests';
import { getSerializedMirageModel } from '@datahub/utils/test-helpers/serialize-mirage-model';
import HealthHealthFactors, { baseClass } from '@datahub/shared/components/health/health-factors';
import sinon from 'sinon';
import { getRenderedComponent } from '@datahub/utils/test-helpers/register-component';
module('Integration | Component | health/health-factors', function(hooks): void {
setupRenderingTest(hooks);
setupMirage(hooks);
test('it renders', async function(this: MirageTestContext, assert): Promise<void> {
const { server } = this;
const titleLabelSelector = `.${baseClass}__title`;
const ownershipValidatorActionSelector = `.${baseClass}__table button`;
const onHealthFactorAction = sinon.fake();
server.createList('entityHealth', 1);
const [health] = getSerializedMirageModel('entityHealths', server);
this.setProperties({ health, onHealthFactorAction });
const component = await getRenderedComponent({
ComponentToRender: HealthHealthFactors,
template: hbs`<Health::HealthFactors @health={{this.health}} @onHealthFactorAction={{this.onHealthFactorAction}} />`,
testContext: this,
componentName: 'health/health-factors'
});
assert.dom(titleLabelSelector).hasText(/Overall Health\:/);
assert.equal(
document.querySelectorAll('tbody tr').length,
health.validations.length,
'Expected the number of rows to match the available validations'
);
server.createList('entityHealth', 1, {
validations: [
{
validator: 'com.linkedin.metadata.validators.OwnershipValidator',
tier: 'MINOR',
weight: 3,
description: '',
score: 1
}
]
});
const [, ownershipHealth] = getSerializedMirageModel('entityHealths', server);
this.set('health', ownershipHealth);
await settled();
assert.dom(ownershipValidatorActionSelector).exists();
assert.dom(ownershipValidatorActionSelector).hasText('View Owners');
await click(ownershipValidatorActionSelector);
assert.ok(
onHealthFactorAction.calledWith(component.healthProxy.validations.firstObject),
'Expected action to be called with ownership validator'
);
});
});