Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('finds mocked directives', () => {
const {findDirective} = new Rendering(fixture, element, instance, {}, testSetup);
expect(findDirective(DirectiveToMock) instanceof MockDirective(DirectiveToMock)).toBe(true);
});
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MatListModule, RouterTestingModule],
declarations: [
PageInformationComponent,
MockComponent({ selector: 'mat-card' }),
MockComponent({ selector: 'mat-card-title' }),
MockComponent({ selector: 'mat-card-header' }),
MockComponent({ selector: 'mat-card-content' }),
MockComponent({ selector: 'mat-card-subtitle' }),
MockDirective(FeedbackDrawerDirective)
],
providers: [WINDOW_PROVIDER],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [NgxsModule.forRoot([AppState]), HttpClientTestingModule, RouterTestingModule],
declarations: [AppComponent, MockDirective(FeatureFlagDirective)],
providers: [
{ provide: PersonService, useValue: null },
{ provide: SwUpdate, useValue: null },
{ provide: MailService, useValue: null },
{ provide: MatSnackBar, useValue: null },
{ provide: ServiceWorkerService, useValue: null },
{ provide: FeatureFlagService, useValue: null },
{ provide: MatDialog, useValue: null },
{ provide: I18n, useClass: MockI18nService },
{ provide: ThemeService, useValue: null }
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
beforeEach(async () => {
MockedDirective = MockDirective(DirectiveToMock);
MockedStructuralDirective = MockDirective(StructuralDirectiveToMock);
MockedComponent = MockComponent(ComponentToMock);
testSetup = new TestSetup(OuterComponent, class {});
testSetup.mockCache.add(DirectiveToMock, MockedDirective);
testSetup.mockCache.add(ComponentToMock, MockedComponent);
return TestBed.configureTestingModule({
declarations: [
TestHostComponent,
OuterComponent,
OtherComponent,
InnerComponent,
TestDirective,
OtherDirective,
MockedComponent,
MockedDirective,
MockedStructuralDirective
beforeEach(async(() => {
TestBed.configureTestingModule({
schemas: [NO_ERRORS_SCHEMA],
declarations: [SettingsComponent, MockDirective(FeatureFlagDirective)],
providers: [{ provide: ThemeService, useClass: MockThemeService }]
}).compileComponents();
}));
beforeEach((done) => {
TestBed.configureTestingModule({
declarations: [
MockDirective(CustomTypeDirective),
MockDirective(CustomRootComponent),
],
}).compileComponents().then(done);
});
beforeEach((done) => {
TestBed.configureTestingModule({
declarations: [
MockDirective(CustomTypeDirective),
MockDirective(CustomRootComponent),
],
}).compileComponents().then(done);
});
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
TestedComponent,
MockDirective(DependencyDirective),
]
});
fixture = TestBed.createComponent(TestedComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
beforeEach(async () => {
MockedDirective = MockDirective(DirectiveToMock);
MockedStructuralDirective = MockDirective(StructuralDirectiveToMock);
MockedComponent = MockComponent(ComponentToMock);
testSetup = new TestSetup(OuterComponent, class {});
testSetup.mockCache.add(DirectiveToMock, MockedDirective);
testSetup.mockCache.add(ComponentToMock, MockedComponent);
return TestBed.configureTestingModule({
declarations: [
TestHostComponent,
OuterComponent,
OtherComponent,
InnerComponent,
TestDirective,
OtherDirective,
MockedComponent,
MockedDirective,
MockedStructuralDirective
],
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule, TranslateModule.forRoot()],
declarations: [
LoginModalComponent,
MockComponent(LoginFormContainerComponent),
MockDirective(ServerHtmlDirective),
],
}).compileComponents();
}));