Skip to content

Unit Test Helpers

Charles Alleman edited this page Aug 25, 2021 · 2 revisions

BAW Services

createComponentFactory({
  component: MockComponent,
  imports: [MockBawApiModule],
});

App Config Service

createComponentFactory({
  component: MockComponent,
  imports: [MockAppConfigModule],
});

Formly

createComponentFactory({
  component: MockComponent,
  imports: [...testFormImports],
  declarations: [FormComponent],
  mocks: [ToastrService],
});

General

  • Have you added SharedModule?

    createComponentFactory({
      component: MockComponent,
      imports: [SharedModule],
    });
  • If the component uses any directives, but cannot import the SharedModule

    createComponentFactory({
      component: MockComponent,
      imports: [DirectivesModule],
    });
  • Need to change the size of the browser?

    • Set the size of the window using the following options (sizes relate to bootstrap):

      viewport.set("extra-large");
      viewport.set("large");
      viewport.set("medium");
      viewport.set("small");
      viewport.set("extra-small");
Clone this wiki locally