How to use the ng-mocks.MockComponent function in ng-mocks

To help you get started, we’ve selected a few ng-mocks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DSpace / dspace-angular / src / app / shared / dso-selector / modal-wrappers / dso-selector-modal-wrapper.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [TranslateModule.forRoot()],
      declarations: [TestComponent, MockComponent(DSOSelectorComponent)],
      providers: [
        { provide: NgbActiveModal, useValue: modalStub },
        {
          provide: ActivatedRoute,
          useValue: { root: { firstChild: { firstChild: { data: observableOf({ item: itemRD }) } } } }
        }
      ],
      schemas: [NO_ERRORS_SCHEMA]
    }).compileComponents();

  }));
github intershop / intershop-pwa / src / app / shared / basket / components / basket-validation-products / basket-validation-products.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        BasketValidationProductsComponent,
        MockComponent(ProductImageComponent),
        MockComponent(ProductInventoryComponent),
        MockPipe(PricePipe),
        MockPipe(ProductRoutePipe),
      ],
      imports: [RouterTestingModule, TranslateModule.forRoot()],
    }).compileComponents();
  }));
github intershop / intershop-pwa / src / app / shared / line-item / components / line-item-edit / line-item-edit.component.spec.ts View on Github external
TestBed.configureTestingModule({
      imports: [
        FormsSharedModule,
        PipesModule,
        ReactiveFormsModule,
        StoreModule.forRoot({
          shopping: combineReducers(shoppingReducers),
        }),
        TranslateModule.forRoot(),
      ],
      declarations: [
        LineItemEditComponent,
        LineItemEditDialogComponent,
        LineItemEditDialogContainerComponent,
        MockComponent(LoadingComponent),
        MockComponent(ModalDialogComponent),
        MockComponent(ProductIdComponent),
        MockComponent(ProductImageComponent),
        MockComponent(ProductInventoryComponent),
        MockComponent(ProductVariationSelectComponent),
      ],
    }).compileComponents();
  }));
github intershop / intershop-pwa / src / app / pages / forgot-password / update-password / update-password.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        MockComponent(LoadingComponent),
        MockComponent(RequestReminderFormComponent),
        MockComponent(ServerHtmlDirective),
        MockComponent(UpdatePasswordFormComponent),
        UpdatePasswordComponent,
      ],
      imports: [RouterTestingModule, TranslateModule.forRoot(), ngrxTesting({ reducers: coreReducers })],
    }).compileComponents();
  }));
github intershop / intershop-pwa / src / app / pages / checkout-address / checkout-address / checkout-address.component.spec.ts View on Github external
beforeEach(async(() => {
    @Component({ template: 'dummy' })
    class DummyComponent {}

    TestBed.configureTestingModule({
      declarations: [
        CheckoutAddressComponent,
        DummyComponent,
        MockComponent(BasketCostSummaryComponent),
        MockComponent(BasketInvoiceAddressWidgetComponent),
        MockComponent(BasketItemsSummaryComponent),
        MockComponent(BasketShippingAddressWidgetComponent),
        MockComponent(BasketValidationResultsComponent),
        MockComponent(ContentIncludeComponent),
        MockComponent(ErrorMessageComponent),
        MockComponent(ModalDialogLinkComponent),
      ],
      imports: [
        NgbCollapseModule,
        ReactiveFormsModule,
        RouterTestingModule.withRoutes([{ path: 'checkout/shipping', component: DummyComponent }]),
        TranslateModule.forRoot(),
      ],
    }).compileComponents();
  }));
github intershop / intershop-pwa / src / app / shared / basket / components / basket-validation-results / basket-validation-results.component.spec.ts View on Github external
beforeEach(async(() => {
    checkoutFacadeMock = mock(CheckoutFacade);
    when(checkoutFacadeMock.basketValidationResults$).thenReturn(of(undefined));

    TestBed.configureTestingModule({
      declarations: [
        BasketValidationResultsComponent,
        MockComponent(BasketValidationItemsComponent),
        MockComponent(BasketValidationProductsComponent),
      ],
      imports: [
        TranslateModule.forRoot(),
        ngrxTesting({
          reducers: {
            checkout: combineReducers(checkoutReducers),
          },
        }),
      ],
      providers: [{ provide: CheckoutFacade, useFactory: () => instance(checkoutFacadeMock) }],
    }).compileComponents();
  }));
github intershop / intershop-pwa / src / app / extensions / quoting / pages / quote-edit / quote-edit-page.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [MockComponent(LoadingComponent), MockComponent(QuoteEditComponent), QuoteEditPageComponent],
      imports: [
        RouterTestingModule.withRoutes([{ path: 'basket', component: QuoteEditPageComponent }]),
        TranslateModule.forRoot(),
        ngrxTesting({
          reducers: {
            quoting: combineReducers(quotingReducers),
            shopping: combineReducers(shoppingReducers),
          },
        }),
      ],
    }).compileComponents();
  }));
github intershop / intershop-pwa / src / app / pages / forgot-password / request-reminder / request-reminder.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        MockComponent(LoadingComponent),
        MockComponent(RequestReminderFormComponent),
        MockComponent(ServerHtmlDirective),
        MockComponent(UpdatePasswordFormComponent),
        RequestReminderComponent,
      ],
      imports: [RouterTestingModule, TranslateModule.forRoot(), ngrxTesting({ reducers: coreReducers })],
    }).compileComponents();
  }));
github intershop / intershop-pwa / src / app / pages / checkout-address / checkout-address / checkout-address.component.spec.ts View on Github external
beforeEach(async(() => {
    @Component({ template: 'dummy' })
    class DummyComponent {}

    TestBed.configureTestingModule({
      declarations: [
        CheckoutAddressComponent,
        DummyComponent,
        MockComponent(BasketCostSummaryComponent),
        MockComponent(BasketInvoiceAddressWidgetComponent),
        MockComponent(BasketItemsSummaryComponent),
        MockComponent(BasketShippingAddressWidgetComponent),
        MockComponent(BasketValidationResultsComponent),
        MockComponent(ContentIncludeComponent),
        MockComponent(ErrorMessageComponent),
        MockComponent(ModalDialogLinkComponent),
      ],
      imports: [
        NgbCollapseModule,
        ReactiveFormsModule,
        RouterTestingModule.withRoutes([{ path: 'checkout/shipping', component: DummyComponent }]),
        TranslateModule.forRoot(),
      ],
    }).compileComponents();
  }));
github intershop / intershop-pwa / src / app / shared / forms / components / select-region / select-region.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        MockComponent(FormControlFeedbackComponent),
        MockComponent(ShowFormFeedbackDirective),
        SelectRegionComponent,
      ],
      imports: [ReactiveFormsModule, TranslateModule.forRoot()],
    })
      .compileComponents()
      .then(() => {
        fixture = TestBed.createComponent(SelectRegionComponent);
        component = fixture.componentInstance;
        element = fixture.nativeElement;

        const form = new FormGroup({
          countryCode: new FormControl('BG'),
          state: new FormControl('Region1', [Validators.required]),
        });
        component.form = form;
        component.regions = [

ng-mocks

An Angular testing library for creating mock services, components, directives, pipes and modules in unit tests. It provides shallow rendering, precise stubs to fake child dependencies. ng-mocks works with Angular 5 6 7 8 9 10 11 12 13 14 15, jasmine and j

MIT
Latest version published 4 days ago

Package Health Score

89 / 100
Full package analysis