@@ -37,7 +37,7 @@ describe('Effect Schematic', () => {
37
37
appTree = createWorkspace ( schematicRunner , appTree ) ;
38
38
} ) ;
39
39
40
- it ( 'should create an effect' , ( ) => {
40
+ it ( 'should create an effect with a spec file ' , ( ) => {
41
41
const options = { ...defaultOptions } ;
42
42
43
43
const tree = schematicRunner . runSchematic ( 'effect' , options , appTree ) ;
@@ -215,7 +215,45 @@ describe('Effect Schematic', () => {
215
215
) ;
216
216
217
217
expect ( content ) . toMatch (
218
- / i m p o r t \ \{ \ F o o A c t i o n s , \ F o o A c t i o n T y p e s \ } \ f r o m \ \' \. \. \/ \. \. \/ a c t i o n s \/ f o o \/ f o o \. a c t i o n s ' ; /
218
+ / i m p o r t \{ F o o A c t i o n T y p e s } f r o m \' \. \. \/ \. \. \/ a c t i o n s \/ f o o \/ f o o \. a c t i o n s ' ; /
219
+ ) ;
220
+ } ) ;
221
+
222
+ it ( 'should create an effect that describes a source of actions within a feature' , ( ) => {
223
+ const options = { ...defaultOptions , feature : true } ;
224
+
225
+ const tree = schematicRunner . runSchematic ( 'effect' , options , appTree ) ;
226
+ const content = tree . readContent (
227
+ `${ projectPath } /src/app/foo/foo.effects.ts`
228
+ ) ;
229
+ expect ( content ) . toMatch (
230
+ / i m p o r t { A c t i o n s , E f f e c t , o f T y p e } f r o m ' @ n g r x \/ e f f e c t s ' ; /
231
+ ) ;
232
+ expect ( content ) . toMatch (
233
+ / i m p o r t { F o o A c t i o n T y p e s } f r o m ' \. \/ f o o .a c t i o n s ' ; /
234
+ ) ;
235
+ expect ( content ) . toMatch ( / e x p o r t c l a s s F o o E f f e c t s / ) ;
236
+ expect ( content ) . toMatch (
237
+ / l o a d F o o s \$ = t h i s \. a c t i o n s \$ .p i p e \( o f T y p e \( F o o A c t i o n T y p e s \. L o a d F o o s \) \) ; /
238
+ ) ;
239
+ } ) ;
240
+
241
+ it ( 'should create an effect that does not define a source of actions within the root' , ( ) => {
242
+ const options = { ...defaultOptions , root : true } ;
243
+
244
+ const tree = schematicRunner . runSchematic ( 'effect' , options , appTree ) ;
245
+ const content = tree . readContent (
246
+ `${ projectPath } /src/app/foo/foo.effects.ts`
247
+ ) ;
248
+ expect ( content ) . toMatch (
249
+ / i m p o r t { A c t i o n s , E f f e c t } f r o m ' @ n g r x \/ e f f e c t s ' ; /
250
+ ) ;
251
+ expect ( content ) . not . toMatch (
252
+ / i m p o r t { F o o A c t i o n T y p e s } f r o m ' \. \/ f o o .a c t i o n s ' ; /
253
+ ) ;
254
+ expect ( content ) . toMatch ( / e x p o r t c l a s s F o o E f f e c t s / ) ;
255
+ expect ( content ) . not . toMatch (
256
+ / l o a d F o o s \$ = t h i s \. a c t i o n s \$ .p i p e \( o f T y p e \( F o o A c t i o n T y p e s \. L o a d F o o s \) \) ; /
219
257
) ;
220
258
} ) ;
221
259
} ) ;
0 commit comments