@@ -27,6 +27,7 @@ describe('Effect Schematic', () => {
2727 feature : false ,
2828 root : false ,
2929 group : false ,
30+ effectCreators : false ,
3031 } ;
3132
3233 const projectPath = getTestProjectPath ( ) ;
@@ -316,4 +317,42 @@ describe('Effect Schematic', () => {
316317 / c o n s t r u c t o r \( p r i v a t e a c t i o n s \$ : A c t i o n s < F o o A c t i o n s > \) { } /
317318 ) ;
318319 } ) ;
320+
321+ it ( 'should create an effect using creator function' , ( ) => {
322+ const options = { ...defaultOptions , effectCreators : true , feature : true } ;
323+
324+ const tree = schematicRunner . runSchematic ( 'effect' , options , appTree ) ;
325+ const content = tree . readContent (
326+ `${ projectPath } /src/app/foo/foo.effects.ts`
327+ ) ;
328+ expect ( content ) . toMatch (
329+ / i m p o r t { A c t i o n s , c r e a t e 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 ' ; /
330+ ) ;
331+ expect ( content ) . not . toMatch ( / @ E f f e c t \( \) / ) ;
332+ expect ( content ) . toMatch (
333+ / l o a d F o o s \$ = c r e a t e E f f e c t \( \( \) = > t h i s .a c t i o n s \$ .p i p e \( /
334+ ) ;
335+ } ) ;
336+
337+ it ( 'should create an api effect using creator function' , ( ) => {
338+ const options = {
339+ ...defaultOptions ,
340+ effectCreators : true ,
341+ api : true ,
342+ feature : true ,
343+ } ;
344+
345+ const tree = schematicRunner . runSchematic ( 'effect' , options , appTree ) ;
346+ const content = tree . readContent (
347+ `${ projectPath } /src/app/foo/foo.effects.ts`
348+ ) ;
349+
350+ expect ( content ) . toMatch (
351+ / i m p o r t { A c t i o n s , c r e a t e 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 ' ; /
352+ ) ;
353+ expect ( content ) . not . toMatch ( / @ E f f e c t \( \) / ) ;
354+ expect ( content ) . toMatch (
355+ / l o a d F o o s \$ = c r e a t e E f f e c t \( \( \) = > t h i s .a c t i o n s \$ .p i p e \( /
356+ ) ;
357+ } ) ;
319358} ) ;
0 commit comments