@@ -20,7 +20,7 @@ describe('BookEditComponent', () => {
2020 ] ,
2121 imports : [
2222 FormsModule ,
23- RouterTestingModule . withRoutes ( [ ] )
23+ RouterTestingModule
2424 ] ,
2525 providers : [ { provide : BookDataService , useClass : BookStaticAsyncDataService } ]
2626 } )
@@ -30,7 +30,6 @@ describe('BookEditComponent', () => {
3030 beforeEach ( async ( ( ) => {
3131 fixture = TestBed . createComponent ( BookEditComponent ) ;
3232 component = fixture . componentInstance ;
33- component . ngOnInit ( ) ;
3433 fixture . detectChanges ( ) ;
3534 compiled = fixture . debugElement . nativeElement ;
3635 } ) ) ;
@@ -40,26 +39,14 @@ describe('BookEditComponent', () => {
4039 } ) ;
4140
4241 it ( 'should display the isbn of the loaded book' , ( ) => {
43- expect ( compiled . querySelector ( 'input[name="isbn"]' ) . value ) . toContain ( '978-0-20163-361-0' ) ;
44- expect ( compiled . querySelector ( 'input[name="title"]' ) . value ) . toContain ( 'esign Patterns' ) ;
45- expect ( compiled . querySelector ( 'input[name="author"]' ) . value ) . toContain ( 'Erich Gamma / Richard Helm / Ralph E. Johnson / John Vlissides' ) ;
42+ expect ( true ) . toBeFalsy ( ) ;
4643 } ) ;
4744
48- it ( 'should validate that title is required' , fakeAsync ( ( ) => {
49- compiled . querySelector ( 'input[name="title"]' ) . value = ''
50- compiled . querySelector ( 'input[name="title"]' ) . dispatchEvent ( new Event ( 'input' ) ) ;
51-
52- tick ( ) ;
53- fixture . detectChanges ( ) ;
54-
55- expect ( compiled . querySelector ( '.title-error' ) . innerText ) . toContain ( 'Title is required' ) ;
45+ it ( 'should validate that title is required and show an error message' , fakeAsync ( ( ) => {
46+ expect ( true ) . toBeFalsy ( ) ;
5647 } ) ) ;
5748
58- it ( 'should submit the whole form' , fakeAsync ( ( ) => {
59- const submitSpy = spyOn ( component , 'onSubmit' ) ;
60-
61- compiled . querySelector ( 'button[type="submit"]' ) . click ( )
62-
63- expect ( submitSpy . calls . any ( ) ) . toBeTruthy ( ) ;
64- } ) ) ;
49+ it ( 'should submit the whole form on click on the submit button' , ( ) => {
50+ expect ( true ) . toBeFalsy ( ) ;
51+ } ) ;
6552} ) ;
0 commit comments