Skip to content

Commit b7bb271

Browse files
committed
test(book-new): deactivate all tests
1 parent f29ff1e commit b7bb271

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

src/app/book/book-new/book-new.component.spec.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('BookNewComponent', () => {
2121
imports: [
2222
FormsModule,
2323
ReactiveFormsModule,
24-
RouterTestingModule.withRoutes([])
24+
RouterTestingModule
2525
],
2626
providers: [{ provide: BookDataService, useClass: BookStaticAsyncDataService }]
2727
})
@@ -31,38 +31,28 @@ describe('BookNewComponent', () => {
3131
beforeEach(async(() => {
3232
fixture = TestBed.createComponent(BookNewComponent);
3333
component = fixture.componentInstance;
34-
component.ngOnInit();
3534
fixture.detectChanges();
3635
compiled = fixture.debugElement.nativeElement;
3736
}));
3837

38+
// Tip: This tests based on reactive-forms, take a look at the BookNew Class (form attribute)
3939
it('should be created', () => {
4040
expect(component).toBeTruthy();
4141
});
4242

4343
it('should be invalid when initialized', () => {
44-
expect(component.form.valid).toBeFalsy()
44+
expect(true).toBeFalsy();
4545
});
4646

47-
it('should require title', () => {
48-
let errors = {};
49-
let title = component.form.controls['title'];
50-
errors = title.errors || {};
51-
expect(errors['required']).toBeTruthy();
47+
it('should require title otherwise mark form as invalid', () => {
48+
expect(true).toBeFalsy();
5249
});
5350

54-
it('should call createBook on submit', inject([BookDataService], (service: BookDataService) => {
55-
const serviceSpy = spyOn(service, 'createBook').and.callThrough();
56-
57-
component.form.controls['isbn'].setValue("1234567890123");
58-
component.form.controls['title'].setValue("Test Book");
59-
component.form.controls['author'].setValue("A author");
60-
61-
expect(component.form.valid).toBeTruthy();
62-
63-
component.onSubmit()
64-
65-
expect(serviceSpy.calls.any()).toBeTruthy();
51+
it('should be valid if all values are valid', () => {
52+
expect(true).toBeFalsy();
53+
});
6654

55+
it('should call BookData.createBook on submit', inject([BookDataService], (service: BookDataService) => {
56+
expect(true).toBeFalsy();
6757
}));
6858
});

0 commit comments

Comments
 (0)