Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(async(() => {
return TestBed.configureTestingModule({
declarations: [ExampleViewerComponent],
imports: [BrowserAnimationsModule, HttpClientModule, MatButtonModule, MatTabsModule, MatTooltipModule, StarkPrettyPrintModule],
providers: [
{ provide: ComponentFixtureAutoDetect, useValue: true },
{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() },
FileService
],
schemas: [NO_ERRORS_SCHEMA] // tells the Angular compiler to ignore unrecognized elements and attributes: mat-icon
}).compileComponents();
}));beforeEach(async(() => {
mockStarkProgressIndicatorService = new MockStarkProgressIndicatorService();
return TestBed.configureTestingModule({
imports: [],
declarations: [TestComponent, StarkProgressIndicatorComponent, StarkProgressIndicatorDirective],
providers: [
{ provide: STARK_PROGRESS_INDICATOR_SERVICE, useValue: mockStarkProgressIndicatorService },
{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() }
]
})
.overrideModule(BrowserDynamicTestingModule, {
// FIXME review after https://github.com/angular/angular/issues/10760
// add entryComponent to TestingModule (suggested in https://github.com/angular/angular/issues/10760#issuecomment-250522300)
set: { entryComponents: [StarkProgressIndicatorComponent] }
})
.compileComponents();
}));beforeEach(async(() => {
return TestBed.configureTestingModule({
declarations: [StarkActionBarComponent, TestHostComponent],
imports: [MatButtonModule, MatMenuModule, MatTooltipModule, TranslateModule.forRoot()],
providers: [
{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() },
TranslateService,
{
// See https://github.com/NationalBankBelgium/stark/issues/1088
provide: HAMMER_LOADER,
useValue: (): Promise => new Subject().toPromise()
}
],
schemas: [NO_ERRORS_SCHEMA] // tells the Angular compiler to ignore unrecognized elements and attributes (svgIcon)
}).compileComponents();
}));beforeEach(async(() => {
return (
TestBed.configureTestingModule({
declarations: [NewsPageComponent],
schemas: [NO_ERRORS_SCHEMA], // to avoid errors due to "mat-icon" directive not known (which we don't want to add in these tests)
imports: [StoreModule.forRoot({}), HttpClientTestingModule],
providers: [{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() }]
})
/**
* Compile template and css.
*/
.compileComponents()
);
}));beforeEach(async(() => {
return (
TestBed.configureTestingModule({
declarations: [StarkAppMenuItemComponent, TestHostComponent],
imports: [MatExpansionModule, MatListModule, NoopAnimationsModule, UIRouterModule],
providers: [
{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() },
{ provide: STARK_ROUTING_SERVICE, useValue: mockRoutingService }
],
schemas: [NO_ERRORS_SCHEMA] // tells the Angular compiler to ignore unrecognized elements and attributes (svgIcon)
})
/**
* Compile template and css
*/
.compileComponents()
);
}));beforeEach(async(() => {
const mockLogger: MockStarkLoggingService = new MockStarkLoggingService();
const afterDismissedObs: Observable = new Observable((o: Observer) => {
observer = o;
});
const mockSnackBar: SpyObj = createSpyObj("MatSnackBar", {
openFromComponent: createSpyObj>("MatSnackBarRef", {
afterDismissed: afterDismissedObs,
dismissWithAction: jasmine.createSpy("dismissWithAction"),
dismiss: jasmine.createSpy("dismiss")
}),
dismiss: undefined
});
const mockApplicationRef: SpyObj = createSpyObj("ApplicationRef", {
tick: undefined
});
service = new StarkToastNotificationServiceImpl(mockSnackBar, mockLogger, mockApplicationRef, {
delay: 3000,describe("AppDataComponent", () => {
let component: StarkAppDataComponent;
let fixture: ComponentFixture;
const mockLogger: MockStarkLoggingService = new MockStarkLoggingService();
beforeEach(async(() => {
return TestBed.configureTestingModule({
declarations: [StarkAppDataComponent],
imports: [CommonModule, MatButtonModule, MatIconModule, MatMenuModule, MatTooltipModule, TranslateModule.forRoot()],
providers: [{ provide: STARK_LOGGING_SERVICE, useValue: mockLogger }, TranslateService]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(StarkAppDataComponent);
component = fixture.componentInstance;
spyOn(component, "removeWindowClickHandler").and.callThrough();
spyOn(component, "attachWindowClickHandler").and.callThrough();
spyOn(window, "addEventListener").and.callThrough();function compileComponent(mockSessionService: MockStarkSessionService): Promise {
return TestBed.configureTestingModule({
imports: [CommonModule, MatButtonToggleModule, MatFormFieldModule, MatSelectModule, TranslateModule.forRoot()],
declarations: [StarkDropdownComponent, StarkLanguageSelectorComponent, TestHostComponent],
providers: [
{ provide: STARK_APP_METADATA, useValue: appMetadata },
{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() },
{ provide: STARK_SESSION_SERVICE, useValue: mockSessionService },
DateAdapter
]
}).compileComponents();
}beforeEach(async(() => {
return (
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot()],
declarations: [StarkAppFooterComponent],
providers: [{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() }, TranslateService]
})
/**
* Compile template and css
*/
.compileComponents()
);
}));describe("PreloadingPageComponent", () => {
let component: StarkPreloadingPageComponent;
let fixture: ComponentFixture;
const mockUser: StarkUser = { firstName: "John", lastName: "Doe", username: "jdoe", uuid: "mock-uuid", roles: [] };
const mockLogger: MockStarkLoggingService = new MockStarkLoggingService();
const mockUserService: MockStarkUserService = new MockStarkUserService();
const mockSessionService: MockStarkSessionService = new MockStarkSessionService();
const mockRoutingService: MockStarkRoutingService = new MockStarkRoutingService();
beforeEach(async(() => {
return TestBed.configureTestingModule({
declarations: [StarkAppLogoComponent, StarkSessionCardComponent, StarkPreloadingPageComponent],
imports: [CommonModule, MatButtonModule, MatCardModule, TranslateModule.forRoot()],
providers: [
{ provide: STARK_LOGGING_SERVICE, useValue: mockLogger },
{ provide: STARK_ROUTING_SERVICE, useValue: mockRoutingService },
{ provide: STARK_USER_SERVICE, useValue: mockUserService },
{ provide: STARK_SESSION_SERVICE, useValue: mockSessionService }
]
}).compileComponents();
}));