This repository was archived by the owner on May 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -174,9 +174,38 @@ export class AppModule {}
174
174
175
175
const knownPath = '/some/fake/path' ;
176
176
const sourceFile = tsUtils . getTypescriptSourceFile ( knownPath , knownContent ) ;
177
- const result : any = tsUtils . getNgModuleDecorator ( 'coolFile.ts' , sourceFile ) ;
177
+ const result = tsUtils . getNgModuleDecorator ( 'coolFile.ts' , sourceFile ) ;
178
178
179
179
expect ( result ) . toEqual ( jasmine . any ( Object ) ) ;
180
180
} ) ;
181
+
182
+ it ( 'should throw an error' , ( ) => {
183
+ const messedUpContent = `
184
+ import { NgModule } from '@angular/core';
185
+ import { BrowserModule } from '@angular/platform-browser';
186
+ import { IonicApp, IonicModule } from '../../../../..';
187
+
188
+ import { AppComponent } from './app.component';
189
+ import { RootPageModule } from '../pages/root-page/root-page.module';
190
+
191
+ ({
192
+ declarations: [
193
+ AppComponent
194
+ ],
195
+ imports: [
196
+ BrowserModule,
197
+ IonicModule.forRoot(AppComponent),
198
+ RootPageModule
199
+ ],
200
+ bootstrap: [IonicApp],
201
+ })
202
+ export class AppModule {}
203
+
204
+ ` ;
205
+ const knownPath = '/some/fake/path' ;
206
+ const sourceFile = tsUtils . getTypescriptSourceFile ( knownPath , messedUpContent ) ;
207
+
208
+ expect ( ( ) => tsUtils . getNgModuleDecorator ( 'coolFile.ts' , sourceFile ) ) . toThrowError ( 'Could not find an "NgModule" decorator in coolFile.ts' ) ;
209
+ } ) ;
181
210
} ) ;
182
211
} ) ;
You can’t perform that action at this time.
0 commit comments