@@ -136,14 +136,47 @@ export class TacoBellModule {}
136
136
} ) ;
137
137
138
138
it ( 'should return the same file content as the import is already in the file' , ( ) => {
139
- const filePath = '/path/to/my/file' ;
140
- const fileContent = 'import { A } from "modulePath"' ;
141
- const namedImport = 'A' ;
142
- const fromModule = `modulePath` ;
139
+ const filePath = '/path/to/my/file' ;
140
+ const fileContent = 'import { A } from "modulePath"' ;
141
+ const namedImport = 'A' ;
142
+ const fromModule = `modulePath` ;
143
143
144
- const result = tsUtils . insertNamedImportIfNeeded ( filePath , fileContent , namedImport , fromModule ) ;
144
+ const result = tsUtils . insertNamedImportIfNeeded ( filePath , fileContent , namedImport , fromModule ) ;
145
145
146
- expect ( result ) . toEqual ( fileContent ) ;
146
+ expect ( result ) . toEqual ( fileContent ) ;
147
+ } ) ;
147
148
} ) ;
149
+
150
+ describe ( 'getNgModuleDecorator' , ( ) => {
151
+ it ( 'should return an object' , ( ) => {
152
+ const knownContent = `
153
+ import { NgModule } from '@angular/core';
154
+ import { BrowserModule } from '@angular/platform-browser';
155
+ import { IonicApp, IonicModule } from '../../../../..';
156
+
157
+ import { AppComponent } from './app.component';
158
+ import { RootPageModule } from '../pages/root-page/root-page.module';
159
+
160
+ @NgModule({
161
+ declarations: [
162
+ AppComponent
163
+ ],
164
+ imports: [
165
+ BrowserModule,
166
+ IonicModule.forRoot(AppComponent),
167
+ RootPageModule
168
+ ],
169
+ bootstrap: [IonicApp],
170
+ })
171
+ export class AppModule {}
172
+
173
+ ` ;
174
+
175
+ const knownPath = '/some/fake/path' ;
176
+ const sourceFile = tsUtils . getTypescriptSourceFile ( knownPath , knownContent ) ;
177
+ const result : any = tsUtils . getNgModuleDecorator ( 'coolFile.ts' , sourceFile ) ;
178
+
179
+ expect ( result ) . toEqual ( jasmine . any ( Object ) ) ;
180
+ } ) ;
148
181
} ) ;
149
182
} ) ;
0 commit comments