Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'/apps/web-viewer/src/app/features/foo/components/foo/foo.component.html'
)
).toBeGreaterThanOrEqual(-1);
expect(
files.indexOf(
'/apps/web-viewer/src/app/features/foo/components/foo/foo.component.ts'
)
).toBeGreaterThanOrEqual(-1);
// file content
let modulePath = '/xplat/nativescript/features/foo/foo.module.ts';
let featureModule = getFileContent(tree, modulePath);
// console.log(modulePath + ':');
// console.log(featureModule);
expect(featureModule).toMatch(
isInModuleMetadata('FooModule', 'imports', `UIModule`, true)
);
expect(featureModule).toMatch(
`import { UIModule } from \'../ui/ui.module\'`
);
modulePath = '/xplat/web/features/foo/foo.module.ts';
featureModule = getFileContent(tree, modulePath);
// console.log(modulePath + ':');
// console.log(featureModule);
expect(featureModule).toMatch(
isInModuleMetadata('FooModule', 'imports', `UIModule`, true)
);
expect(featureModule).toMatch(
`import { UIModule } from \'../ui/ui.module\'`
);
});
it('should create root NgModule with bootstrap information', async () => {
const options = { ...defaultOptions };
const tree = await runSchematic('app', options, appTree);
const appModule = getFileContent(
tree,
'/apps/nativescript-foo/src/app.module.ts'
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'bootstrap', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'declarations', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'CoreModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'SharedModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'AppRoutingModule', true)
);
expect(appModule).toMatch("import { AppComponent } from './app.component'");
});
it('should create root NgModule with bootstrap information', async () => {
const options = { ...defaultOptions };
const tree = await runSchematic('app', options, appTree);
const appModule = getFileContent(
tree,
'/apps/nativescript-foo/src/app.module.ts'
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'bootstrap', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'declarations', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'CoreModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'SharedModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'AppRoutingModule', true)
);
expect(appModule).toMatch("import { AppComponent } from './app.component'");
});
it('should create root NgModule with bootstrap information', async () => {
const options = { ...defaultOptions };
const tree = await runSchematic('app', options, appTree);
const appModule = getFileContent(
tree,
'/apps/nativescript-foo/src/app.module.ts'
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'bootstrap', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'declarations', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'CoreModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'SharedModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'AppRoutingModule', true)
);
expect(appModule).toMatch("import { AppComponent } from './app.component'");
});
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'bootstrap', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'declarations', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'CoreModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'SharedModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'AppRoutingModule', true)
);
expect(appModule).toMatch("import { AppComponent } from './app.component'");
});
const appModule = getFileContent(
tree,
'/apps/nativescript-foo/src/app.module.ts'
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'bootstrap', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'declarations', 'AppComponent', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'CoreModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'SharedModule', true)
);
expect(appModule).toMatch(
isInModuleMetadata('AppModule', 'imports', 'AppRoutingModule', true)
);
expect(appModule).toMatch("import { AppComponent } from './app.component'");
});
JSON.stringify({
dependencies: {},
devDependencies: {},
xplat: {
prefix: 'tt'
}
})
);
const tree = await runSchematic('app', options, appTree);
const appModule = getFileContent(
tree,
'/apps/nativescript-foo/src/core/core.module.ts'
);
expect(appModule).toMatch(
isInModuleMetadata(
'CoreModule',
'imports',
`${stringUtils.classify(options.prefix)}CoreModule`,
true
)
);
expect(appModule).toMatch(
`import { ${stringUtils.classify(options.prefix)}CoreModule } from \'@${
options.npmScope
}/nativescript-angular\'`
);
});