File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
modules/schematics/src/store Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ describe('Store Schematic', () => {
17
17
) ;
18
18
const defaultOptions : StoreOptions = {
19
19
name : 'foo' ,
20
- // path: 'app',
21
20
project : 'bar' ,
22
21
spec : true ,
23
22
module : undefined ,
@@ -63,7 +62,17 @@ describe('Store Schematic', () => {
63
62
) ;
64
63
} ) ;
65
64
66
- it ( 'should import the environments correctly' , ( ) => {
65
+ it ( 'should import the environments correctly in the app module' , ( ) => {
66
+ const options = { ...defaultOptions , module : 'app.module.ts' } ;
67
+
68
+ const tree = schematicRunner . runSchematic ( 'store' , options , appTree ) ;
69
+ const content = tree . readContent ( `${ projectPath } /src/app/app.module.ts` ) ;
70
+ expect ( content ) . toMatch (
71
+ / i m p o r t { e n v i r o n m e n t } f r o m ' ..\/ e n v i r o n m e n t s \/ e n v i r o n m e n t ' ; /
72
+ ) ;
73
+ } ) ;
74
+
75
+ it ( 'should import the environments correctly in the reducers' , ( ) => {
67
76
const options = { ...defaultOptions , module : 'app.module.ts' } ;
68
77
69
78
const tree = schematicRunner . runSchematic ( 'store' , options , appTree ) ;
Original file line number Diff line number Diff line change @@ -54,10 +54,10 @@ function addImportToNgModule(options: StoreOptions): Rule {
54
54
55
55
const statePath = `${ options . path } /${ options . statePath } ` ;
56
56
const relativePath = buildRelativePath ( modulePath , statePath ) ;
57
- const srcPath = dirname ( options . path as Path ) ;
57
+
58
58
const environmentsPath = buildRelativePath (
59
59
statePath ,
60
- `${ srcPath } /environments/environment`
60
+ `${ options . path } /environments/environment`
61
61
) ;
62
62
63
63
const storeNgModuleImport = addImportToModule (
You can’t perform that action at this time.
0 commit comments