Added tests

This commit is contained in:
Giuseppe Digilio
2019-01-08 23:25:44 +01:00
parent 959c02af74
commit 967d682962
17 changed files with 1094 additions and 393 deletions

View File

@@ -10,7 +10,7 @@ import {
DynamicFormValidationService,
DynamicInputModel
} from '@ng-dynamic-forms/core';
import { Store } from '@ngrx/store';
import { Store, StoreModule } from '@ngrx/store';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
@@ -124,7 +124,6 @@ function init() {
}
};
store = new MockStore<FormState>(formState);
}
describe('FormComponent test suite', () => {
@@ -144,6 +143,7 @@ describe('FormComponent test suite', () => {
FormsModule,
ReactiveFormsModule,
NgbModule.forRoot(),
StoreModule.forRoot({}),
TranslateModule.forRoot()
],
declarations: [
@@ -157,9 +157,7 @@ describe('FormComponent test suite', () => {
FormComponent,
FormService,
{ provide: GLOBAL_CONFIG, useValue: config },
{
provide: Store, useValue: store
}
{ provide: Store, useClass: MockStore }
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});
@@ -177,6 +175,7 @@ describe('FormComponent test suite', () => {
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
testComp = testFixture.componentInstance;
});
afterEach(() => {
testFixture.destroy();
@@ -194,6 +193,7 @@ describe('FormComponent test suite', () => {
beforeEach(() => {
formFixture = TestBed.createComponent(FormComponent);
store = TestBed.get(Store);
formComp = formFixture.componentInstance; // FormComponent test instance
formComp.formId = 'testForm';
formComp.formModel = TEST_FORM_MODEL;
@@ -384,6 +384,7 @@ describe('FormComponent test suite', () => {
beforeEach(() => {
formFixture = TestBed.createComponent(FormComponent);
store = TestBed.get(Store);
formComp = formFixture.componentInstance; // FormComponent test instance
formComp.formId = 'testFormArray';
formComp.formModel = TEST_FORM_MODEL_WITH_ARRAY;