mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-03-12 01:32:12 +00:00
test: clean up async behaviour
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion,@typescript-eslint/ban-ts-comment */
|
||||
import {
|
||||
APP_BASE_HREF,
|
||||
CommonModule,
|
||||
@@ -36,22 +37,21 @@ import {FilterContext, SortContext} from './context-type';
|
||||
import {Component} from '@angular/core';
|
||||
import {By} from '@angular/platform-browser';
|
||||
|
||||
// prettier-ignore
|
||||
@Component({
|
||||
template: `
|
||||
<ion-content id="foo"></ion-content>
|
||||
<stapps-context contentId="foo"></stapps-context>
|
||||
`,
|
||||
template: `<ion-content id="foo"></ion-content
|
||||
><stapps-context contentId="foo"></stapps-context>
|
||||
`,
|
||||
})
|
||||
class ContextMenuComponentContainer {
|
||||
}
|
||||
class ContextMenuContainerComponent {}
|
||||
|
||||
describe('ContextMenuComponent', async () => {
|
||||
let fixture: ComponentFixture<ContextMenuComponentContainer>;
|
||||
let fixture: ComponentFixture<ContextMenuContainerComponent>;
|
||||
let instance: ContextMenuComponent;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ContextMenuComponent, ContextMenuComponentContainer],
|
||||
declarations: [ContextMenuComponent, ContextMenuContainerComponent],
|
||||
providers: [
|
||||
ChildrenOutletContexts,
|
||||
Location,
|
||||
@@ -70,8 +70,10 @@ describe('ContextMenuComponent', async () => {
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ContextMenuComponentContainer);
|
||||
instance = fixture.debugElement.query(By.directive(ContextMenuComponent)).componentInstance;
|
||||
fixture = TestBed.createComponent(ContextMenuContainerComponent);
|
||||
instance = fixture.debugElement.query(
|
||||
By.directive(ContextMenuComponent),
|
||||
).componentInstance;
|
||||
});
|
||||
|
||||
it('should show items in sort context', () => {
|
||||
|
||||
@@ -27,11 +27,11 @@ describe('ContextMenuService', () => {
|
||||
});
|
||||
|
||||
it('should update filterQuery', done => {
|
||||
service.filterContextChanged$.subscribe(() => {
|
||||
service.contextFilterChanged(filterContext);
|
||||
});
|
||||
service.filterQueryChanged$.subscribe(result => {
|
||||
service.filterContextChanged$.subscribe(result => {
|
||||
expect(result).toBeDefined();
|
||||
expect(service.contextFilter.options[0].buckets.length).toEqual(
|
||||
filterContext.options[0].buckets.length,
|
||||
);
|
||||
done();
|
||||
});
|
||||
service.updateContextFilter(facetsMock);
|
||||
@@ -46,10 +46,7 @@ describe('ContextMenuService', () => {
|
||||
});
|
||||
|
||||
it('should update sortQuery', done => {
|
||||
service.sortContextChanged$.subscribe(() => {
|
||||
service.contextSortChanged(sortContext);
|
||||
});
|
||||
service.sortQueryChanged$.subscribe(result => {
|
||||
service.sortContextChanged$.subscribe(result => {
|
||||
expect(result).toBeDefined();
|
||||
done();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user