Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should create feature module (with dashes in name) for specified projects WITH Routing', async () => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree, true);
const options: XplatFeatureHelpers.Schema = { ...defaultOptions };
// console.log('appTree:', appTree);
options.onlyProject = true;
options.routing = true;
options.name = 'foo-with-dash';
let tree = await runSchematic('feature', options, appTree);
const files = tree.files;
// console.log(files.slice(85,files.length));
// feature should not be in shared code
expect(files.indexOf('/libs/features/foo-with-dash/index.ts')).toBe(-1);
expect(
files.indexOf('/xplat/nativescript/features/foo-with-dash/index.ts')
).toBe(-1);
expect(files.indexOf('/xplat/web/features/foo-with-dash/index.ts')).toBe(
-1
it('should create component for specified platforms with framework name when no default is set', async () => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree);
// console.log('appTree:', appTree);
let tree = await runSchematic(
'feature',
{
name: 'foo',
platforms: 'nativescript,web',
isTesting: true
},
appTree
);
const options: XplatComponentHelpers.Schema = { ...defaultOptions };
delete options.framework;
tree = await runSchematic('component', options, tree);
const files = tree.files;
// console.log(files);//.slice(91,files.length));
it('should create component for specified platforms with framework name when no default is set', async () => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree);
// console.log('appTree:', appTree);
let tree = await runSchematic(
'feature',
{
name: 'foo',
platforms: 'nativescript,web'
},
appTree
);
const options: XplatComponentHelpers.Schema = { ...defaultOptions };
tree = await runSchematic('component', options, tree);
const files = tree.files;
// console.log(files);//.slice(91,files.length));
// component
expect(
it('should create feature module with a single starting component with framework suffix for xplat when no default is set', async () => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree);
const options: XplatFeatureHelpers.Schema = { ...defaultOptions };
// console.log('appTree:', appTree);
let tree = await runSchematic('feature', options, appTree);
const files = tree.files;
// console.log(files.slice(85,files.length));
expect(
files.indexOf('/apps/nativescript-viewer/package.json')
).toBeGreaterThanOrEqual(0);
expect(
files.indexOf('/apps/web-viewer/src/app/features/core/core.module.ts')
).toBeGreaterThanOrEqual(0);
// shared code defaults
expect(files.indexOf('/libs/features/index.ts')).toBeGreaterThanOrEqual(0);
expect(
files.indexOf('/xplat/nativescript-angular/index.ts')
it('should create feature module for specified project WITH Routing and adjustSandbox', async () => {
const options: XplatFeatureHelpers.Schema = {
...defaultOptions,
projects: 'nativescript-viewer'
};
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree, true);
// manually update home.component to prep for sandobx
const homeCmpPath = `/apps/nativescript-viewer/src/features/home/components/home.component.html`;
createOrUpdate(appTree, homeCmpPath, sandboxHomeSetup());
// console.log('homecmp:', getFileContent(tree, homeCmpPath));
options.onlyProject = true;
options.adjustSandbox = true;
options.routing = true;
options.name = 'foo-with-dash';
let tree = await runSchematic('feature', options, appTree);
// console.log('---------')
// console.log('homecmp:', getFileContent(tree, homeCmpPath));
});
});
beforeEach(() => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree, null, 'angular');
});
beforeEach(() => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree);
});
beforeEach(() => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree, null, 'angular');
});
beforeEach(() => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree, false, 'angular');
});
beforeEach(() => {
appTree = Tree.empty();
appTree = createXplatWithNativeScriptWeb(appTree, false, 'angular');
});