@@ -4,7 +4,6 @@ import { ActivatedRoute, RouterModule } from '@angular/router';
4
4
import { ngtx } from '../../ngtx' ;
5
5
import { ScenarioTestingHarness } from '../../scenario-testing/scenario-harnesses' ;
6
6
import { useScenarioTesting } from '../../scenario-testing/scenario-testing' ;
7
- import { NgtxScenarioTestAssertionFn } from '../../scenario-testing/types' ;
8
7
9
8
@Injectable ( )
10
9
class MyService {
@@ -121,15 +120,25 @@ expectThat(
121
120
the . Text . toHaveState ( { text : 'Hello, World!' } ) ,
122
121
) ;
123
122
124
- const beComponentType =
125
- ( type : any ) : NgtxScenarioTestAssertionFn < HTMLElement , any > =>
123
+ const beComponentType = ( type : any ) =>
126
124
// TODO: docs: document that debugElement must only be accessed within it case:
127
- ( addTests , harness ) =>
125
+ ngtx . scenario . testGeneratorFn ( ( addTests , harness ) =>
128
126
addTests ( ( ) => {
129
- it ( `should be the component "${ type . name } "` , ( ) => {
130
- expect ( harness . debugElement . componentInstance ) . toBeInstanceOf ( type ) ;
127
+ const description = harness . isAssertionNegated
128
+ ? `should not be the component "${ type . name } "`
129
+ : `should be the component "${ type . name } "` ;
130
+
131
+ it ( description , ( ) => {
132
+ if ( harness . isAssertionNegated ) {
133
+ expect ( harness . debugElement . componentInstance ) . not . toBeInstanceOf (
134
+ type ,
135
+ ) ;
136
+ } else {
137
+ expect ( harness . debugElement . componentInstance ) . toBeInstanceOf ( type ) ;
138
+ }
131
139
} ) ;
132
- } ) ;
140
+ } ) ,
141
+ ) ;
133
142
134
143
expectThat (
135
144
the . Div . toBeFound ( ) ,
@@ -140,6 +149,7 @@ expectThat(
140
149
beComponentType ( TextComponent ) ,
141
150
beComponentType ( TextComponent ) ,
142
151
) ,
152
+ the . Text . not . to ( beComponentType ( ScenarioTestComponent ) ) ,
143
153
) ;
144
154
145
155
tests . run ( ) ;
0 commit comments