101 lines
3.8 KiB
TypeScript
101 lines
3.8 KiB
TypeScript
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
import { GroupsComponent } from './groups.component';
|
|
import { MatInputModule } from '@angular/material/input';
|
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { MatOptionModule } from '@angular/material/core';
|
|
import { MatDividerModule } from '@angular/material/divider';
|
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
import { MatIconModule } from '@angular/material/icon';
|
|
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
import { MatSelectModule } from '@angular/material/select';
|
|
import { MatTableModule } from '@angular/material/table';
|
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
import { ToastrModule } from 'ngx-toastr';
|
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
import { MatListModule } from '@angular/material/list';
|
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
import { MatCardModule } from '@angular/material/card';
|
|
import { TranslateModule } from '@ngx-translate/core';
|
|
import { JoyrideModule } from 'ngx-joyride';
|
|
import { MatMenuModule } from '@angular/material/menu';
|
|
import { MatTreeModule } from '@angular/material/tree';
|
|
|
|
describe('GroupsComponent', () => {
|
|
let component: GroupsComponent;
|
|
let fixture: ComponentFixture<GroupsComponent>;
|
|
|
|
beforeEach(async () => {
|
|
await TestBed.configureTestingModule({
|
|
declarations: [GroupsComponent],
|
|
imports: [
|
|
HttpClientTestingModule,
|
|
ToastrModule.forRoot(),
|
|
BrowserAnimationsModule,
|
|
MatDividerModule,
|
|
MatFormFieldModule,
|
|
MatInputModule,
|
|
MatIconModule,
|
|
MatButtonModule,
|
|
MatTableModule,
|
|
MatPaginatorModule,
|
|
MatTooltipModule,
|
|
FormsModule,
|
|
ReactiveFormsModule,
|
|
MatProgressSpinnerModule,
|
|
MatDialogModule,
|
|
MatSelectModule,
|
|
MatTabsModule,
|
|
MatAutocompleteModule,
|
|
MatListModule,
|
|
MatCardModule,
|
|
MatMenuModule,
|
|
MatTreeModule,
|
|
TranslateModule.forRoot(),
|
|
JoyrideModule.forRoot(),
|
|
],
|
|
providers: [
|
|
{ provide: MatDialogRef, useValue: {} },
|
|
{ provide: MAT_DIALOG_DATA, useValue: { data: { id: 123 } } }
|
|
]
|
|
})
|
|
.compileComponents();
|
|
|
|
fixture = TestBed.createComponent(GroupsComponent);
|
|
component = fixture.componentInstance;
|
|
fixture.detectChanges();
|
|
});
|
|
|
|
it('should create', () => {
|
|
expect(component).toBeTruthy();
|
|
});
|
|
|
|
it('should call search on ngOnInit', () => {
|
|
spyOn(component, 'search');
|
|
component.ngOnInit();
|
|
expect(component.search).toHaveBeenCalled();
|
|
});
|
|
|
|
it('should call getFilters on ngOnInit', () => {
|
|
spyOn(component, 'getFilters');
|
|
component.ngOnInit();
|
|
expect(component.getFilters).toHaveBeenCalled();
|
|
});
|
|
|
|
it('should call search method', () => {
|
|
spyOn(component, 'search');
|
|
component.search();
|
|
expect(component.search).toHaveBeenCalled();
|
|
});
|
|
|
|
it('should call getFilters method', () => {
|
|
spyOn(component, 'getFilters');
|
|
component.getFilters();
|
|
expect(component.getFilters).toHaveBeenCalled();
|
|
});
|
|
});
|