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

75 lines
2.4 KiB
TypeScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { FeatureEntity } from '@datahub/data-models/entity/feature/feature-entity';
import { TestContext } from 'ember-test-helpers';
import EmberRouter from '@ember/routing/router';
import { getContext } from '@ember/test-helpers';
module('Integration | Component | browser/search-within-hierarchy', function(hooks): void {
setupRenderingTest(hooks);
const componentRef = '.data-search-hierarchy';
const entityType = FeatureEntity.displayName;
let count = 0;
let segments: Array<string> = [];
hooks.beforeEach(function(this: TestContext) {
count = 0;
segments = [];
this.setProperties({
count,
entityType,
segments
});
// Stubbing route service is require to properly generate a url
const { owner } = getContext() as TestContext;
const CustomRouter = EmberRouter.extend();
CustomRouter.map(function() {
this.route('browsesearch', function() {
this.route('entity', {
path: '/:entity'
});
});
});
owner.register('router:main', CustomRouter);
owner.lookup('router:main').setupRouter();
});
test('Component rendering', async function(assert): Promise<void> {
await render(hbs`{{browser/search-within-hierarchy}}`);
assert.dom(componentRef).doesNotExist();
// won't render with count at 0
await render(
hbs`{{browser/search-within-hierarchy count=this.count entityType=this.entityType segments=this.segments}}`
);
assert.dom(componentRef).doesNotExist();
count = 20;
this.set('count', count);
// Render with count at 20 and no segments
await render(
hbs`{{browser/search-within-hierarchy count=this.count entityType=this.entityType segments=this.segments}}`
);
assert.dom(componentRef).doesNotExist();
// Render with count at 20 and segments greater than 0
segments = ['testSegment'];
this.set('segments', segments);
await render(
hbs`{{browser/search-within-hierarchy count=this.count entityType=this.entityType segments=this.segments}}`
);
assert.dom(componentRef).matchesText(`View ${count} ${entityType}`);
assert.dom(componentRef).hasAttribute('href', '#/browsesearch/ml-features?page=1&path=testSegment');
});
});